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 33## [ master] ( https://github.com/arangodb/kube-arangodb/tree/master ) (N/A)
44- (Bugfix) Fix deployment creation on ARM64
55- (DebugPackage) Add Agency Dump & State
6+ - (Bugfix) Fix After leaked GoRoutines
67
78## [ 1.2.23] ( https://github.com/arangodb/kube-arangodb/tree/1.2.23 ) (2023-01-12)
89- (Bugfix) Remove PDBs if group count is 0
Original file line number Diff line number Diff line change 11//
22// DISCLAIMER
33//
4- // Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package timer
2323import "time"
2424
2525func After (duration time.Duration ) <- chan time.Time {
26- r := make (chan time.Time )
26+ r := make (chan time.Time , 1 )
2727
2828 go func () {
2929 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