[#274] wc: Make wait groups work more explicit

Do not run routine that calls `wg.Done()` inside, it is hard to read.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
pull/274/head
Pavel Karpy 2023-04-20 17:59:44 +03:00
parent 4f5f832137
commit 6b6f33ed71
1 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,10 @@ func (c *cache) runFlushLoop() {
}
c.wg.Add(1)
go c.flushBigObjects(context.TODO())
go func() {
c.flushBigObjects(context.TODO())
c.wg.Done()
}()
c.wg.Add(1)
go func() {
@ -146,8 +149,6 @@ func (c *cache) flushDB() {
}
func (c *cache) flushBigObjects(ctx context.Context) {
defer c.wg.Done()
tick := time.NewTicker(defaultFlushInterval * 10)
for {
select {