Merge pull request #1830 from yashsinghcodes/nightly

add a random sleep so no two worker check cache at same time
This commit is contained in:
Aditya
2025-10-06 16:53:38 +05:30
committed by GitHub
+6
View File
@@ -3874,6 +3874,12 @@ func sendAppRequest(ctx context.Context, incomingUrl, appName string, port int,
// Checking as LATE as possible, ensuring we don't rerun what's already ran // Checking as LATE as possible, ensuring we don't rerun what's already ran
// ctx = context.Background() // ctx = context.Background()
// Sleep between 0 and 250 ms for randomness so no same worker check at same time (same as cloud)
rand.Seed(time.Now().UnixNano())
randMs := rand.Intn(250)
time.Sleep(time.Duration(randMs) * time.Millisecond)
newExecId := fmt.Sprintf("%s_%s", workflowExecution.ExecutionId, action.ID) newExecId := fmt.Sprintf("%s_%s", workflowExecution.ExecutionId, action.ID)
_, err = shuffle.GetCache(ctx, newExecId) _, err = shuffle.GetCache(ctx, newExecId)
if err == nil { if err == nil {