From 410f9970f1f367127568af4306af46dc4f6f2c1d Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Mon, 18 Sep 2023 22:07:32 +0800 Subject: [PATCH 1/2] chore: clean up some comments and CI yaml --- .github/workflows/test.yml | 2 +- pool.go | 6 +----- pool_func.go | 6 +----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27d85c8f..33ff07ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,7 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.go }}-go-ci - - name: Run unit tests + - name: Run unit tests and integrated tests run: go test -v -race -coverprofile="codecov.report" -covermode=atomic - name: Upload code coverage report to Codecov diff --git a/pool.go b/pool.go index bdf34541..e05b9043 100644 --- a/pool.go +++ b/pool.go @@ -107,7 +107,7 @@ func (p *Pool) purgeStaleWorkers(ctx context.Context) { } // There might be a situation where all workers have been cleaned up(no worker is running), - // while some invokers still are stuck in "p.cond.Wait()", then we need to awake those invokers. + // while some invokers still are stuck in p.cond.Wait(), then we need to awake those invokers. if isDormant && p.Waiting() > 0 { p.cond.Broadcast() } @@ -207,8 +207,6 @@ func NewPool(size int, options ...Option) (*Pool, error) { return p, nil } -// --------------------------------------------------------------------------- - // Submit submits a task to this pool. // // Note that you are allowed to call Pool.Submit() from the current Pool.Submit(), @@ -321,8 +319,6 @@ func (p *Pool) Reboot() { } } -// --------------------------------------------------------------------------- - func (p *Pool) addRunning(delta int) { atomic.AddInt32(&p.running, int32(delta)) } diff --git a/pool_func.go b/pool_func.go index e41ae0e5..4f19e18b 100644 --- a/pool_func.go +++ b/pool_func.go @@ -108,7 +108,7 @@ func (p *PoolWithFunc) purgeStaleWorkers(ctx context.Context) { } // There might be a situation where all workers have been cleaned up(no worker is running), - // while some invokers still are stuck in "p.cond.Wait()", then we need to awake those invokers. + // while some invokers still are stuck in p.cond.Wait(), then we need to awake those invokers. if isDormant && p.Waiting() > 0 { p.cond.Broadcast() } @@ -213,8 +213,6 @@ func NewPoolWithFunc(size int, pf func(interface{}), options ...Option) (*PoolWi return p, nil } -//--------------------------------------------------------------------------- - // Invoke submits a task to pool. // // Note that you are allowed to call Pool.Invoke() from the current Pool.Invoke(), @@ -327,8 +325,6 @@ func (p *PoolWithFunc) Reboot() { } } -//--------------------------------------------------------------------------- - func (p *PoolWithFunc) addRunning(delta int) { atomic.AddInt32(&p.running, int32(delta)) } From 3ae3e8ed8c8420732e72719794ab349dcc185e2d Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Mon, 18 Sep 2023 22:28:39 +0800 Subject: [PATCH 2/2] chore: cleanup --- pool.go | 2 +- pool_func.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pool.go b/pool.go index e05b9043..2dcf1861 100644 --- a/pool.go +++ b/pool.go @@ -106,7 +106,7 @@ func (p *Pool) purgeStaleWorkers(ctx context.Context) { staleWorkers[i] = nil } - // There might be a situation where all workers have been cleaned up(no worker is running), + // There might be a situation where all workers have been cleaned up (no worker is running), // while some invokers still are stuck in p.cond.Wait(), then we need to awake those invokers. if isDormant && p.Waiting() > 0 { p.cond.Broadcast() diff --git a/pool_func.go b/pool_func.go index 4f19e18b..ce8a0b1f 100644 --- a/pool_func.go +++ b/pool_func.go @@ -107,7 +107,7 @@ func (p *PoolWithFunc) purgeStaleWorkers(ctx context.Context) { staleWorkers[i] = nil } - // There might be a situation where all workers have been cleaned up(no worker is running), + // There might be a situation where all workers have been cleaned up (no worker is running), // while some invokers still are stuck in p.cond.Wait(), then we need to awake those invokers. if isDormant && p.Waiting() > 0 { p.cond.Broadcast()