[#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 committed by Evgenii Stratonikov
parent c60029d3b0
commit ab65063d6d

View file

@ -32,11 +32,11 @@ 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.workerFlushSmall()
} }
c.wg.Add(1) c.wg.Add(1)
go c.flushBigObjects() go c.workerFlushBig()
c.wg.Add(1) c.wg.Add(1)
go func() { go func() {
@ -48,7 +48,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
@ -57,7 +57,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 {
@ -140,7 +140,7 @@ func (c *cache) flushDB() {
} }
} }
func (c *cache) flushBigObjects() { func (c *cache) workerFlushBig() {
defer c.wg.Done() defer c.wg.Done()
tick := time.NewTicker(defaultFlushInterval * 10) tick := time.NewTicker(defaultFlushInterval * 10)
@ -222,8 +222,8 @@ func (c *cache) flushFSTree(ignoreErrors bool) error {
return err return err
} }
// flushWorker writes objects to the main storage. // workerFlushSmall writes small objects to the main storage.
func (c *cache) flushWorker(_ int) { func (c *cache) workerFlushSmall() {
defer c.wg.Done() defer c.wg.Done()
var obj *object.Object var obj *object.Object