[#314] wc: Simplify background workers naming

Also, drop not used arg.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
Pavel Karpy 2023-05-05 18:40:57 +03:00
parent 77b1b80e73
commit 1e6ffd45ad

View file

@ -37,7 +37,7 @@ const (
func (c *Cache) runFlushLoop() { func (c *Cache) runFlushLoop() {
for i := 0; i < c.workersCount; i++ { for i := 0; i < c.workersCount; i++ {
c.wg.Add(1) c.wg.Add(1)
go c.flushWorker(i) go c.smallObjectsFlusher()
} }
c.wg.Add(1) c.wg.Add(1)
@ -56,7 +56,7 @@ func (c *Cache) runFlushLoop() {
for { for {
select { select {
case <-tt.C: case <-tt.C:
c.flushDB() c.flushSmallObjects()
tt.Reset(defaultFlushInterval) tt.Reset(defaultFlushInterval)
case <-c.closeCh: case <-c.closeCh:
return return
@ -65,7 +65,7 @@ func (c *Cache) runFlushLoop() {
}() }()
} }
func (c *Cache) flushDB() { func (c *Cache) flushSmallObjects() {
var lastKey []byte var lastKey []byte
var m []objectInfo var m []objectInfo
for { for {
@ -228,8 +228,8 @@ func (c *Cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
return err return err
} }
// flushWorker writes objects to the main storage. // smallObjectsFlusher writes small objects to the main storage.
func (c *Cache) flushWorker(_ int) { func (c *Cache) smallObjectsFlusher() {
defer c.wg.Done() defer c.wg.Done()
var obj *object.Object var obj *object.Object