Skip to content

Commit 1d6d553

Browse files
committed
allows overriding max concurrency via env var
1 parent 74e27b6 commit 1d6d553

File tree

1 file changed

+10
-1
lines changed
  • worker/pkg/workflows/ee/piidetect/workflows/job

1 file changed

+10
-1
lines changed

worker/pkg/workflows/ee/piidetect/workflows/job/workflow.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
mgmtv1alpha1 "github.com/nucleuscloud/neosync/backend/gen/go/protos/mgmt/v1alpha1"
1010
piidetect_job_activities "github.com/nucleuscloud/neosync/worker/pkg/workflows/ee/piidetect/workflows/job/activities"
1111
piidetect_table_workflow "github.com/nucleuscloud/neosync/worker/pkg/workflows/ee/piidetect/workflows/table"
12+
"github.com/spf13/viper"
1213
"go.temporal.io/sdk/log"
1314
"go.temporal.io/sdk/temporal"
1415
"go.temporal.io/sdk/workflow"
@@ -139,7 +140,7 @@ func (w *Workflow) orchestrateTables(
139140

140141
workselector := workflow.NewNamedSelector(ctx, "job_pii_detect")
141142

142-
maxConcurrency := 3
143+
maxConcurrency := getTablePiiDetectMaxConcurrency()
143144
inFlightLimiter := workflow.NewSemaphore(ctx, int64(maxConcurrency))
144145

145146
tableWf := piidetect_table_workflow.New()
@@ -230,3 +231,11 @@ var invalidWorkflowIDChars = regexp.MustCompile(`[^a-zA-Z0-9_\-]`)
230231
func sanitizeWorkflowID(id string) string {
231232
return invalidWorkflowIDChars.ReplaceAllString(id, "_")
232233
}
234+
235+
func getTablePiiDetectMaxConcurrency() int {
236+
maxConcurrency := viper.GetInt("TABLE_PII_DETECT_MAX_CONCURRENCY")
237+
if maxConcurrency <= 0 {
238+
return 3 // default max concurrency
239+
}
240+
return maxConcurrency
241+
}

0 commit comments

Comments
 (0)