[#642] writecache: Remove usage of close channel in badger

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2023-09-19 08:43:13 +03:00 committed by Evgenii Stratonikov
parent b0cf100427
commit c0b86f2d93
3 changed files with 30 additions and 34 deletions

View file

@ -1,12 +1,13 @@
package writecachebadger
import (
"context"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
)
func (c *cache) runGCLoop() {
func (c *cache) runGCLoop(ctx context.Context) {
c.wg.Add(1)
go func() {
@ -17,7 +18,7 @@ func (c *cache) runGCLoop() {
for {
select {
case <-c.closeCh:
case <-ctx.Done():
return
case <-t.C:
// This serves to synchronize the c.db field when changing mode as well.