diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index f1c832f89..4a3666a76 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -52,6 +52,7 @@ type eventHandlers struct { type gc struct { *gcCfg + onceStop sync.Once stopChannel chan struct{} workerPool util.WorkerPool @@ -163,7 +164,9 @@ func (gc *gc) tickRemover() { } func (gc *gc) stop() { - gc.stopChannel <- struct{}{} + gc.onceStop.Do(func() { + gc.stopChannel <- struct{}{} + }) } // iterates over metabase graveyard and deletes objects