diff --git a/base/commands/migration/migration_stages.go b/base/commands/migration/migration_stages.go index 9d176e6f..a5a191e2 100644 --- a/base/commands/migration/migration_stages.go +++ b/base/commands/migration/migration_stages.go @@ -200,6 +200,9 @@ func saveReportToFile(ctx context.Context, ci *hazelcast.ClientInternal, migrati func WaitForMigrationToBeInProgress(ctx context.Context, ci *hazelcast.ClientInternal, migrationID string) error { for { + if ctx.Err() != nil { + return ctx.Err() + } status, err := fetchMigrationStatus(ctx, ci, migrationID) if err != nil { if errors.Is(err, migrationStatusNotFoundErr) { diff --git a/base/commands/migration/start_stages.go b/base/commands/migration/start_stages.go index 4b8179bf..87ed5f67 100644 --- a/base/commands/migration/start_stages.go +++ b/base/commands/migration/start_stages.go @@ -80,7 +80,7 @@ func (st *StartStages) startStage() func(context.Context, stage.Statuser[any]) ( if err = st.startQueue.Put(ctx, cb); err != nil { return nil, fmt.Errorf("updating start Queue: %w", err) } - childCtx, cancel := context.WithTimeout(ctx, 30*time.Second) + childCtx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel() if err = waitForMigrationToStart(childCtx, st.ci, st.migrationID); err != nil { return nil, err @@ -91,7 +91,7 @@ func (st *StartStages) startStage() func(context.Context, stage.Statuser[any]) ( func (st *StartStages) preCheckStage() func(context.Context, stage.Statuser[any]) (any, error) { return func(ctx context.Context, status stage.Statuser[any]) (any, error) { - childCtx, cancel := context.WithTimeout(ctx, 30*time.Second) + childCtx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel() if err := WaitForMigrationToBeInProgress(childCtx, st.ci, st.migrationID); err != nil { return nil, fmt.Errorf("waiting for prechecks to complete: %w", err) @@ -102,6 +102,9 @@ func (st *StartStages) preCheckStage() func(context.Context, stage.Statuser[any] func waitForMigrationToStart(ctx context.Context, ci *hazelcast.ClientInternal, migrationID string) error { for { + if ctx.Err() != nil { + return ctx.Err() + } status, err := fetchMigrationStatus(ctx, ci, migrationID) if err != nil { if errors.Is(err, migrationStatusNotFoundErr) {