From 908c63c1bed3dabca4344d994b0015c4ea40375a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philip=20Dub=C3=A9?= <philip@peerdb.io>
Date: Fri, 15 Mar 2024 19:44:56 +0000
Subject: [PATCH] Move reading PEERDB_DISABLE_ONE_SYNC into side effect

---
 flow/workflows/sync_flow.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/flow/workflows/sync_flow.go b/flow/workflows/sync_flow.go
index 3295957049..6b7c202978 100644
--- a/flow/workflows/sync_flow.go
+++ b/flow/workflows/sync_flow.go
@@ -28,9 +28,12 @@ func SyncFlowWorkflow(
 	parent := workflow.GetInfo(ctx).ParentWorkflowExecution
 	logger := log.With(workflow.GetLogger(ctx), slog.String(string(shared.FlowNameKey), config.FlowJobName))
 
+	disableOneSync := GetSideEffect(ctx, func(_ workflow.Context) bool {
+		return peerdbenv.PeerDBDisableOneSync()
+	})
 	var fMaintain workflow.Future
 	var sessionID string
-	if !peerdbenv.PeerDBDisableOneSync() {
+	if !disableOneSync {
 		sessionOptions := &workflow.SessionOptions{
 			CreationTimeout:  5 * time.Minute,
 			ExecutionTimeout: 144 * time.Hour,