From 966e4a50d8d8c2627f29c40d0cdd6549489f48ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 19 Mar 2024 18:30:59 +0000 Subject: [PATCH] fix SyncFlow getting stuck waiting for source connector (#1504) Would cause activity to run on different worker, causing it to get stuck waiting for source connector --- flow/workflows/sync_flow.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flow/workflows/sync_flow.go b/flow/workflows/sync_flow.go index 06665d7379..9958c1c79c 100644 --- a/flow/workflows/sync_flow.go +++ b/flow/workflows/sync_flow.go @@ -33,13 +33,15 @@ func SyncFlowWorkflow( }) var fMaintain workflow.Future var sessionID string + syncSessionCtx := ctx if enableOneSync { sessionOptions := &workflow.SessionOptions{ CreationTimeout: 5 * time.Minute, ExecutionTimeout: 144 * time.Hour, HeartbeatTimeout: time.Minute, } - syncSessionCtx, err := workflow.CreateSession(ctx, sessionOptions) + var err error + syncSessionCtx, err = workflow.CreateSession(ctx, sessionOptions) if err != nil { return err } @@ -103,7 +105,7 @@ func SyncFlowWorkflow( currentSyncFlowNum += 1 logger.Info("executing sync flow", slog.Int("count", currentSyncFlowNum)) - syncFlowCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{ + syncFlowCtx := workflow.WithActivityOptions(syncSessionCtx, workflow.ActivityOptions{ StartToCloseTimeout: 72 * time.Hour, HeartbeatTimeout: time.Minute, WaitForCancellation: true,