forked from TrueCloudLab/frostfs-node
[#314] writecache: Simplify background workers naming
Also, drop not used arg. Signed-off-by: Pavel Karpy <p.karpy@yadro.com>feature/325-policer_off
parent
483fac03d6
commit
9e56592be3
|
@ -37,12 +37,12 @@ const (
|
|||
func (c *cache) runFlushLoop() {
|
||||
for i := 0; i < c.workersCount; i++ {
|
||||
c.wg.Add(1)
|
||||
go c.flushWorker(i)
|
||||
go c.workerFlushSmall()
|
||||
}
|
||||
|
||||
c.wg.Add(1)
|
||||
go func() {
|
||||
c.flushBigObjects(context.TODO())
|
||||
c.workerFlushBig(context.TODO())
|
||||
c.wg.Done()
|
||||
}()
|
||||
|
||||
|
@ -56,7 +56,7 @@ func (c *cache) runFlushLoop() {
|
|||
for {
|
||||
select {
|
||||
case <-tt.C:
|
||||
c.flushDB()
|
||||
c.flushSmallObjects()
|
||||
tt.Reset(defaultFlushInterval)
|
||||
case <-c.closeCh:
|
||||
return
|
||||
|
@ -65,7 +65,7 @@ func (c *cache) runFlushLoop() {
|
|||
}()
|
||||
}
|
||||
|
||||
func (c *cache) flushDB() {
|
||||
func (c *cache) flushSmallObjects() {
|
||||
var lastKey []byte
|
||||
var m []objectInfo
|
||||
for {
|
||||
|
@ -148,7 +148,7 @@ func (c *cache) flushDB() {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *cache) flushBigObjects(ctx context.Context) {
|
||||
func (c *cache) workerFlushBig(ctx context.Context) {
|
||||
tick := time.NewTicker(defaultFlushInterval * 10)
|
||||
for {
|
||||
select {
|
||||
|
@ -228,8 +228,8 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// flushWorker writes objects to the main storage.
|
||||
func (c *cache) flushWorker(_ int) {
|
||||
// workerFlushSmall writes small objects to the main storage.
|
||||
func (c *cache) workerFlushSmall() {
|
||||
defer c.wg.Done()
|
||||
|
||||
var obj *object.Object
|
||||
|
|
Loading…
Reference in New Issue