From b1a07801502f61b6a7063d27f5c7fae2ab72183c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Barroso?= Date: Thu, 3 Oct 2024 15:29:54 +0200 Subject: [PATCH 1/2] need to return err --- docs/test-cases/pipeline-recovery.md | 2 +- pkg/lifecycle/service.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/test-cases/pipeline-recovery.md b/docs/test-cases/pipeline-recovery.md index 432cbbb2d..cab8f48cb 100644 --- a/docs/test-cases/pipeline-recovery.md +++ b/docs/test-cases/pipeline-recovery.md @@ -20,7 +20,7 @@ pipelines: - id: file-pipeline status: running name: file-pipeline - description: test pipline + description: test pipeline connectors: - id: chaos-src type: source diff --git a/pkg/lifecycle/service.go b/pkg/lifecycle/service.go index d01bddd91..067bd285f 100644 --- a/pkg/lifecycle/service.go +++ b/pkg/lifecycle/service.go @@ -802,6 +802,8 @@ func (s *Service) runPipeline(ctx context.Context, rp *runnablePipeline) error { if updateErr := s.pipelines.UpdateStatus(ctx, rp.pipeline.ID, pipeline.StatusDegraded, fmt.Sprintf("%+v", recoveryErr)); updateErr != nil { return updateErr } + + return recoveryErr } // recovery was triggered, so no cleanup // (remove running pipeline, notify failure handlers, etc.) From d5dc4ebbcc7b2f636ee199bd424bb8c5f67a23a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Barroso?= Date: Thu, 3 Oct 2024 15:36:19 +0200 Subject: [PATCH 2/2] assign error --- pkg/lifecycle/service.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/lifecycle/service.go b/pkg/lifecycle/service.go index 067bd285f..afe7cac44 100644 --- a/pkg/lifecycle/service.go +++ b/pkg/lifecycle/service.go @@ -803,13 +803,13 @@ func (s *Service) runPipeline(ctx context.Context, rp *runnablePipeline) error { return updateErr } - return recoveryErr + // we assign it to err so it's returned and notified by the cleanup function + err = recoveryErr + } else { + // recovery was triggered didn't error, so no cleanup + // this is why we return nil to skip the cleanup below. + return nil } - // recovery was triggered, so no cleanup - // (remove running pipeline, notify failure handlers, etc.) - // is needed - // this is why we return nil to skip the cleanup below. - return nil } }