mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: allow users to pause prebuilt workspace reconciliation (#18700)
This PR provides two commands: * `coder prebuilds pause` * `coder prebuilds resume` These allow the suspension of all prebuilds activity, intended for use if prebuilds are misbehaving.
This commit is contained in:
@ -9604,6 +9604,18 @@ func (q *sqlQuerier) GetOAuthSigningKey(ctx context.Context) (string, error) {
|
||||
return value, err
|
||||
}
|
||||
|
||||
const getPrebuildsSettings = `-- name: GetPrebuildsSettings :one
|
||||
SELECT
|
||||
COALESCE((SELECT value FROM site_configs WHERE key = 'prebuilds_settings'), '{}') :: text AS prebuilds_settings
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) GetPrebuildsSettings(ctx context.Context) (string, error) {
|
||||
row := q.db.QueryRowContext(ctx, getPrebuildsSettings)
|
||||
var prebuilds_settings string
|
||||
err := row.Scan(&prebuilds_settings)
|
||||
return prebuilds_settings, err
|
||||
}
|
||||
|
||||
const getRuntimeConfig = `-- name: GetRuntimeConfig :one
|
||||
SELECT value FROM site_configs WHERE site_configs.key = $1
|
||||
`
|
||||
@ -9786,6 +9798,16 @@ func (q *sqlQuerier) UpsertOAuthSigningKey(ctx context.Context, value string) er
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertPrebuildsSettings = `-- name: UpsertPrebuildsSettings :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ('prebuilds_settings', $1)
|
||||
ON CONFLICT (key) DO UPDATE SET value = $1 WHERE site_configs.key = 'prebuilds_settings'
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) UpsertPrebuildsSettings(ctx context.Context, value string) error {
|
||||
_, err := q.db.ExecContext(ctx, upsertPrebuildsSettings, value)
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertRuntimeConfig = `-- name: UpsertRuntimeConfig :exec
|
||||
INSERT INTO site_configs (key, value) VALUES ($1, $2)
|
||||
ON CONFLICT (key) DO UPDATE SET value = $2 WHERE site_configs.key = $1
|
||||
|
Reference in New Issue
Block a user