From b509be44564bb3365d662ea9cd18db5576bd1eef Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Wed, 29 Nov 2023 00:22:30 +0530 Subject: [PATCH] refactoring --- docker-compose-dev.yml | 2 +- docker-compose.yml | 2 +- flow/cmd/handler.go | 6 +++--- flow/shared/constants.go | 2 ++ flow/workflows/cdc_flow.go | 4 ++-- flow/workflows/qrep_flow.go | 2 +- mirror-name-search.sh => scripts/mirror-name-search.sh | 0 7 files changed, 10 insertions(+), 8 deletions(-) rename mirror-name-search.sh => scripts/mirror-name-search.sh (100%) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 8c48ec702..6dbb17074 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -93,7 +93,7 @@ services: timeout: 5s retries: 30 volumes: - - ./mirror-name-search.sh:/etc/temporal/entrypoint.sh + - ./scripts/mirror-name-search.sh:/etc/temporal/entrypoint.sh temporal-ui: container_name: temporal-ui diff --git a/docker-compose.yml b/docker-compose.yml index 523dcb138..440f06545 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -80,7 +80,7 @@ services: timeout: 5s retries: 30 volumes: - - ./mirror-name-search.sh:/etc/temporal/entrypoint.sh + - ./scripts/mirror-name-search.sh:/etc/temporal/entrypoint.sh temporal-ui: container_name: temporal-ui diff --git a/flow/cmd/handler.go b/flow/cmd/handler.go index aafad6b25..128bde255 100644 --- a/flow/cmd/handler.go +++ b/flow/cmd/handler.go @@ -130,7 +130,7 @@ func (h *FlowRequestHandler) CreateCDCFlow( ID: workflowID, TaskQueue: h.peerflowTaskQueueID, SearchAttributes: map[string]interface{}{ - "MirrorName": cfg.FlowJobName, + shared.MirrorNameSearchAttribute: cfg.FlowJobName, }, } @@ -233,7 +233,7 @@ func (h *FlowRequestHandler) CreateQRepFlow( ID: workflowID, TaskQueue: h.peerflowTaskQueueID, SearchAttributes: map[string]interface{}{ - "MirrorName": cfg.FlowJobName, + shared.MirrorNameSearchAttribute: cfg.FlowJobName, }, } if req.CreateCatalogEntry { @@ -318,7 +318,7 @@ func (h *FlowRequestHandler) ShutdownFlow( ID: workflowID, TaskQueue: h.peerflowTaskQueueID, SearchAttributes: map[string]interface{}{ - "MirrorName": req.FlowJobName, + shared.MirrorNameSearchAttribute: req.FlowJobName, }, } dropFlowHandle, err := h.temporalClient.ExecuteWorkflow( diff --git a/flow/shared/constants.go b/flow/shared/constants.go index d1dfbdd6e..48a6f8ae2 100644 --- a/flow/shared/constants.go +++ b/flow/shared/constants.go @@ -11,6 +11,8 @@ const ( CDCFlowSignalName = "peer-flow-signal" ) +const MirrorNameSearchAttribute = "MirrorName" + type CDCFlowSignal int64 type ContextKey string diff --git a/flow/workflows/cdc_flow.go b/flow/workflows/cdc_flow.go index 9d0aae108..2dfe99ff2 100644 --- a/flow/workflows/cdc_flow.go +++ b/flow/workflows/cdc_flow.go @@ -190,7 +190,7 @@ func CDCFlowWorkflowWithConfig( } mirrorNameSearch := map[string]interface{}{ - "MirrorName": cfg.FlowJobName, + shared.MirrorNameSearchAttribute: cfg.FlowJobName, } // start the SetupFlow workflow as a child workflow, and wait for it to complete @@ -330,7 +330,7 @@ func CDCFlowWorkflowWithConfig( } mirrorNameSearch := map[string]interface{}{ - "MirrorName": cfg.FlowJobName, + shared.MirrorNameSearchAttribute: cfg.FlowJobName, } // execute the sync flow as a child workflow childSyncFlowOpts := workflow.ChildWorkflowOptions{ diff --git a/flow/workflows/qrep_flow.go b/flow/workflows/qrep_flow.go index c8a7c1023..d56404af4 100644 --- a/flow/workflows/qrep_flow.go +++ b/flow/workflows/qrep_flow.go @@ -207,7 +207,7 @@ func (q *QRepFlowExecution) startChildWorkflow( MaximumAttempts: 20, }, SearchAttributes: map[string]interface{}{ - "MirrorName": q.config.FlowJobName, + shared.MirrorNameSearchAttribute: q.config.FlowJobName, }, }) diff --git a/mirror-name-search.sh b/scripts/mirror-name-search.sh similarity index 100% rename from mirror-name-search.sh rename to scripts/mirror-name-search.sh