Skip to content

Commit 1411ae8

Browse files
authored
Merge pull request #286 from panjf2000/dev
ver: release v2.8.0
2 parents 78ff6e0 + 45a0390 commit 1411ae8

File tree

4 files changed

+29
-22
lines changed

4 files changed

+29
-22
lines changed

.github/workflows/codeql.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@ on:
77
- dev
88
paths-ignore:
99
- '**.md'
10-
- '.github/FUNDING.yml'
11-
- '.github/release-drafter.yml'
12-
- '.github/ISSUE_TEMPLATE/*'
13-
- '.github/workflows/pull-request.yml'
14-
- '.github/workflows/release-drafter.yml'
10+
- '**.yml'
11+
- '**.yaml'
12+
- '!.github/workflows/codeql.yml'
1513
pull_request:
1614
branches:
1715
- master
1816
- dev
1917
paths-ignore:
2018
- '**.md'
21-
- '.github/FUNDING.yml'
22-
- '.github/release-drafter.yml'
23-
- '.github/ISSUE_TEMPLATE/*'
24-
- '.github/workflows/pull-request.yml'
25-
- '.github/workflows/release-drafter.yml'
19+
- '**.yml'
20+
- '**.yaml'
21+
- '!.github/workflows/codeql.yml'
2622
schedule:
2723
# ┌───────────── minute (0 - 59)
2824
# │ ┌───────────── hour (0 - 23)

.github/workflows/test.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,20 @@ on:
77
- dev
88
paths-ignore:
99
- '**.md'
10-
- '.github/FUNDING.yml'
11-
- '.github/release-drafter.yml'
12-
- '.github/ISSUE_TEMPLATE/*'
13-
- '.github/workflows/codeql.yml'
14-
- '.github/workflows/pull-request.yml'
15-
- '.github/workflows/release-drafter.yml'
10+
- '**.yml'
11+
- '**.yaml'
1612
- 'examples/*'
13+
- '!.github/workflows/test.yml'
1714
pull_request:
1815
branches:
1916
- master
2017
- dev
2118
paths-ignore:
2219
- '**.md'
23-
- '.github/FUNDING.yml'
24-
- '.github/release-drafter.yml'
25-
- '.github/ISSUE_TEMPLATE/*'
26-
- '.github/workflows/codeql.yml'
27-
- '.github/workflows/pull-request.yml'
28-
- '.github/workflows/release-drafter.yml'
20+
- '**.yml'
21+
- '**.yaml'
2922
- 'examples/*'
23+
- '!.github/workflows/test.yml'
3024

3125
env:
3226
GO111MODULE: on

ants.go

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ func Release() {
123123
defaultAntsPool.Release()
124124
}
125125

126+
// ReleaseTimeout is like Release but with a timeout, it waits all workers to exit before timing out.
127+
func ReleaseTimeout(timeout time.Duration) error {
128+
return defaultAntsPool.ReleaseTimeout(timeout)
129+
}
130+
126131
// Reboot reboots the default pool.
127132
func Reboot() {
128133
defaultAntsPool.Reboot()

ants_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -973,3 +973,15 @@ func TestReleaseTimeout(t *testing.T) {
973973
err = pf.ReleaseTimeout(2 * time.Second)
974974
assert.NoError(t, err)
975975
}
976+
977+
func TestDefaultPoolReleaseTimeout(t *testing.T) {
978+
Reboot()
979+
for i := 0; i < 5; i++ {
980+
_ = Submit(func() {
981+
time.Sleep(time.Second)
982+
})
983+
}
984+
assert.NotZero(t, Running())
985+
err := ReleaseTimeout(2 * time.Second)
986+
assert.NoError(t, err)
987+
}

0 commit comments

Comments
 (0)