Skip to content

Commit

Permalink
fix: unroll loop
Browse files Browse the repository at this point in the history
  • Loading branch information
iamKunalGupta committed Nov 4, 2024
1 parent 42ccdb5 commit a451c71
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions flow/activities/maintenance_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ func (a *MaintenanceActivity) checkAndWaitIfSnapshot(
if err != nil {
return mirrorStatus, err
}

slog.Info("Checking if mirror is snapshot", "mirror", mirror.MirrorName, "workflowId", mirror.WorkflowId, "status", mirrorStatus.String())
if mirrorStatus != protos.FlowStatus_STATUS_SNAPSHOT && mirrorStatus != protos.FlowStatus_STATUS_SETUP {
return mirrorStatus, nil
}
slog.Info("Waiting for mirror to finish snapshot",
"mirror", mirror.MirrorName, "workflowId", mirror.WorkflowId, "status", mirrorStatus.String())
defer shared.Interval(ctx, alertEvery, func() {
slog.Warn("[Maintenance] Still waiting for mirror to finish snapshot",
"mirror", mirror.MirrorName, "workflowId", mirror.WorkflowId, "status", mirrorStatus.String())
Expand All @@ -114,6 +107,8 @@ func (a *MaintenanceActivity) checkAndWaitIfSnapshot(
"mirror", mirror.MirrorName, "workflowId", mirror.WorkflowId, "status", mirrorStatus.String())
})()

slog.Info("Checking and waiting if mirror is snapshot", "mirror", mirror.MirrorName, "workflowId", mirror.WorkflowId, "status",
mirrorStatus.String())
snapshotWaitSleepInterval := 10 * time.Second
for mirrorStatus == protos.FlowStatus_STATUS_SNAPSHOT || mirrorStatus == protos.FlowStatus_STATUS_SETUP {
time.Sleep(snapshotWaitSleepInterval)
Expand Down

0 comments on commit a451c71

Please sign in to comment.