Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timeout set to 0 when not explicitly set #283

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/repository/prisma/dbsqlc/workflows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ INSERT INTO "Step" (
@tenantId::uuid,
@jobId::uuid,
@actionId::text,
@timeout::text,
sqlc.narg('timeout')::text,
coalesce(sqlc.narg('customUserData')::jsonb, '{}'),
coalesce(sqlc.narg('retries')::integer, 0),
coalesce(sqlc.narg('scheduleTimeout')::text, '5m')
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/prisma/dbsqlc/workflows.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/repository/prisma/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,13 @@ func (r *workflowEngineRepository) createWorkflowVersionTxs(ctx context.Context,
stepId := uuid.New().String()

var (
timeout string
timeout pgtype.Text
customUserData []byte
retries pgtype.Int4
)

if stepOpts.Timeout != nil {
timeout = *stepOpts.Timeout
timeout = sqlchelpers.TextFromStr(*stepOpts.Timeout)
}

if stepOpts.UserData != nil {
Expand Down
18 changes: 18 additions & 0 deletions prisma/migrations/20240321215205_v0_17_1/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE OR REPLACE FUNCTION convert_duration_to_interval(duration text) RETURNS interval AS $$
DECLARE
num_value INT;
BEGIN
num_value := substring(duration from '^\d+');

RETURN CASE
WHEN duration LIKE '%ms' THEN make_interval(secs => num_value::float / 1000)
WHEN duration LIKE '%s' THEN make_interval(secs => num_value)
WHEN duration LIKE '%m' THEN make_interval(mins => num_value)
WHEN duration LIKE '%h' THEN make_interval(hours => num_value)
WHEN duration LIKE '%d' THEN make_interval(days => num_value)
WHEN duration LIKE '%w' THEN make_interval(days => num_value * 7)
WHEN duration LIKE '%y' THEN make_interval(months => num_value * 12)
ELSE '5 minutes'::interval
END;
END;
$$ LANGUAGE plpgsql;
Loading