Skip to content

Commit 63eb17b

Browse files
bugfix: cache deletion delay safe call to ExpiredDisruptionDelay
1 parent be4cc64 commit 63eb17b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controllers/cache_handler.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,13 @@ func (r *DisruptionReconciler) manageInstanceSelectorCache(instance *chaosv1beta
511511

512512
// start the cache with a cancelable context and duration, and attach it to the controller as a watch source
513513
ch := make(chan error)
514-
cacheCtx, cacheCancelFunc := context.WithTimeout(context.Background(), instance.Spec.Duration.Duration()+*r.ExpiredDisruptionGCDelay*2)
514+
deletionDelay := time.Minute * 2
515+
516+
if r.ExpiredDisruptionGCDelay != nil {
517+
deletionDelay = *r.ExpiredDisruptionGCDelay * 2
518+
}
519+
520+
cacheCtx, cacheCancelFunc := context.WithTimeout(context.Background(), instance.Spec.Duration.Duration()+deletionDelay)
515521

516522
go func() { ch <- cache.Start(cacheCtx) }()
517523

0 commit comments

Comments
 (0)