Skip to content

Commit

Permalink
utils: extend WorkerPool interface with Tune func
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Butusov <[email protected]>
  • Loading branch information
End-rey committed Nov 21, 2024
1 parent b13fa5a commit d0c8059
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/services/object/put/distibuted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (x *testWorkerPool) Submit(f func()) error {
go f()
return nil
}
func (x *testWorkerPool) Tune(_ int) {}

func TestIterateNodesForObject(t *testing.T) {
// nodes: [A B C] [D C E F G] [B H I J]
Expand Down
6 changes: 6 additions & 0 deletions pkg/util/worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type WorkerPool interface {
// functions have returned so synchronization must be achieved
// via other means (e.g. sync.WaitGroup).
Release()

// Tune changes the capacity of this pool.
Tune(int)
}

// pseudoWorkerPool represents a pseudo worker pool which executes the submitted job immediately in the caller's routine.
Expand Down Expand Up @@ -53,3 +56,6 @@ func (p *pseudoWorkerPool) Submit(fn func()) error {
func (p *pseudoWorkerPool) Release() {
p.closed.Store(true)
}

// Tune implements the WorkerPool interface.
func (p *pseudoWorkerPool) Tune(_ int) {}

0 comments on commit d0c8059

Please sign in to comment.