From 2784b5ceba6d2b0ae7d985bc9b1bec2b05f74f87 Mon Sep 17 00:00:00 2001 From: Ignacio Penas Fernandez <11061525+ignacio-penas@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:08:15 +0100 Subject: [PATCH] fix(Job-Engine): Fixed a bug on the timeout of deployment stop (#99) --- common/constants/timeouts.go | 3 ++- workers/job_processor/actions/deployment_stop.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/constants/timeouts.go b/common/constants/timeouts.go index a8525aa5..5d673d79 100644 --- a/common/constants/timeouts.go +++ b/common/constants/timeouts.go @@ -1,5 +1,6 @@ package constants const ( - DefaultJobTimeout = 300 + DefaultJobTimeout = 300 + DefaultPullTimeout = 1200 ) diff --git a/workers/job_processor/actions/deployment_stop.go b/workers/job_processor/actions/deployment_stop.go index cc07f19c..2a8e2ff9 100644 --- a/workers/job_processor/actions/deployment_stop.go +++ b/workers/job_processor/actions/deployment_stop.go @@ -5,7 +5,9 @@ import ( "fmt" "github.com/nuvla/api-client-go/clients/resources" log "github.com/sirupsen/logrus" + "nuvlaedge-go/common/constants" "nuvlaedge-go/workers/job_processor/executors" + "time" ) type DeploymentStop struct { @@ -16,7 +18,7 @@ func (d *DeploymentStop) ExecuteAction(ctx context.Context) error { defer CloseDeploymentClientWithLog(d.client) defer d.executor.Close() - ctxTimed, cancel := context.WithTimeout(ctx, 60) + ctxTimed, cancel := context.WithTimeout(ctx, constants.DefaultJobTimeout*time.Second) defer cancel() if err := d.client.SetState(ctxTimed, resources.StateStopping); err != nil {