Skip to content

Commit

Permalink
Also clean up when cancelling experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
timebertt committed Aug 22, 2023
1 parent b6ec225 commit 95b48ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions webhosting-operator/pkg/experiment/scenario/basic/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,11 @@ func (s *scenario) Start(ctx context.Context) error {

select {
case <-ctx.Done():
log.Info("Scenario cancelled")
return ctx.Err()
log.Info("Scenario cancelled, cleaning up")
case <-time.After(15 * time.Minute):
log.Info("Scenario finished, cleaning up")
}

log.Info("Scenario finished, cleaning up")

cleanupCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,11 @@ func (s *scenario) Start(ctx context.Context) error {

select {
case <-ctx.Done():
log.Info("Scenario cancelled")
return ctx.Err()
log.Info("Scenario cancelled, cleaning up")
case <-time.After(15 * time.Minute):
log.Info("Scenario finished, cleaning up")
}

log.Info("Scenario finished, cleaning up")

cleanupCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

Expand Down

0 comments on commit 95b48ff

Please sign in to comment.