Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Apr 12, 2024
1 parent 92d9d18 commit 59a2c14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions backend/controller/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func (d *DAL) CreateDeployment(ctx context.Context, language string, moduleSchem
NextExecution: job.NextExecution,
})
if err != nil {
return model.DeploymentKey{}, fmt.Errorf("%s: %w", "failed to create cron job", translatePGError(err))
return model.DeploymentKey{}, fmt.Errorf("failed to create cron job: %w", translatePGError(err))
}
}

Expand Down Expand Up @@ -1054,13 +1054,13 @@ func (d *DAL) loadDeployment(ctx context.Context, deployment sql.GetDeploymentRo
func (d *DAL) CreateIngressRequest(ctx context.Context, route, addr string) (model.RequestKey, error) {
key := model.NewRequestKey(model.OriginIngress, route)
err := d.db.CreateIngressRequest(ctx, sql.OriginIngress, key, addr)
return key, err
return key, translatePGError(err)
}

func (d *DAL) CreateCronRequest(ctx context.Context, job CronJob, addr string) (model.RequestKey, error) {
key := model.NewRequestKey(model.OriginCron, fmt.Sprintf("%s-%s", job.Ref.Module, job.Ref.Name))
err := d.db.CreateIngressRequest(ctx, sql.OriginCron, key, addr)
return key, err
return key, translatePGError(err)
}

func (d *DAL) GetIngressRoutes(ctx context.Context, method string) ([]IngressRoute, error) {
Expand Down
14 changes: 7 additions & 7 deletions backend/controller/sql/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,13 @@ FROM cron_jobs j
WHERE d.min_replicas > 0;

-- name: CreateCronJob :exec
INSERT INTO cron_jobs (deployment_id, module_name, verb, schedule, start_time, next_execution)
VALUES ((SELECT id FROM deployments WHERE key = sqlc.arg('deployment_key')::deployment_key LIMIT 1),
sqlc.arg('module_name')::TEXT,
sqlc.arg('verb')::TEXT,
sqlc.arg('schedule')::TEXT,
sqlc.arg('start_time')::TIMESTAMPTZ,
sqlc.arg('next_execution')::TIMESTAMPTZ);
INSERT INTO cron_jobs (deployment_id, module_name, verb, schedule, start_time, next_execution)
VALUES ((SELECT id FROM deployments WHERE key = sqlc.arg('deployment_key')::deployment_key LIMIT 1),
sqlc.arg('module_name')::TEXT,
sqlc.arg('verb')::TEXT,
sqlc.arg('schedule')::TEXT,
sqlc.arg('start_time')::TIMESTAMPTZ,
sqlc.arg('next_execution')::TIMESTAMPTZ);

-- name: StartCronJobs :many
WITH updates AS (
Expand Down

0 comments on commit 59a2c14

Please sign in to comment.