File tree Expand file tree Collapse file tree 3 files changed +48
-2
lines changed Expand file tree Collapse file tree 3 files changed +48
-2
lines changed Original file line number Diff line number Diff line change 3
3
## [ master] ( https://github.com/arangodb/kube-arangodb/tree/master ) (N/A)
4
4
- (Bugfix) Fix deployment creation on ARM64
5
5
- (DebugPackage) Add Agency Dump & State
6
+ - (Bugfix) Fix After leaked GoRoutines
6
7
7
8
## [ 1.2.23] ( https://github.com/arangodb/kube-arangodb/tree/1.2.23 ) (2023-01-12)
8
9
- (Bugfix) Remove PDBs if group count is 0
Original file line number Diff line number Diff line change 1
1
//
2
2
// DISCLAIMER
3
3
//
4
- // Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4
+ // Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
5
5
//
6
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
7
// you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package timer
23
23
import "time"
24
24
25
25
func After (duration time.Duration ) <- chan time.Time {
26
- r := make (chan time.Time )
26
+ r := make (chan time.Time , 1 )
27
27
28
28
go func () {
29
29
defer close (r )
Original file line number Diff line number Diff line change
1
+ //
2
+ // DISCLAIMER
3
+ //
4
+ // Copyright 2023 ArangoDB GmbH, Cologne, Germany
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ //
18
+ // Copyright holder is ArangoDB GmbH, Cologne, Germany
19
+ //
20
+
21
+ package timer
22
+
23
+ import (
24
+ "runtime"
25
+ "testing"
26
+ "time"
27
+
28
+ "github.com/stretchr/testify/require"
29
+ )
30
+
31
+ func checkGoRoutinesLeak (t * testing.T , f func ()) {
32
+ got := runtime .NumGoroutine ()
33
+
34
+ f ()
35
+
36
+ require .Equal (t , got , runtime .NumGoroutine ())
37
+ }
38
+
39
+ func Test_AfterLeaks (t * testing.T ) {
40
+ checkGoRoutinesLeak (t , func () {
41
+ After (time .Second )
42
+
43
+ time .Sleep (5 * time .Second )
44
+ })
45
+ }
You can’t perform that action at this time.
0 commit comments