tests: remove ticker leak
This commit was moved from ipfs/interface-go-ipfs-core@a7d4a7199895a4bd66fa655b73f94ecea4540fdf This commit was moved from ipfs/boxo@b75b1243fb9738e1b5eb6fd19bca980bd156299c
Steven Allen committed
Mar 26, 2019 at 18:37 UTC
ba5e78a4c5de8bc560ba0579887f80aa47844419
1 file changed
+3
-2
core/coreiface/tests/pubsub.go
+3
-2
@@ -35,7 +35,8 @@ func (tp *provider) TestBasicPubSub(t *testing.T) {
35
}
36
37
go func() {
38
- tick := time.Tick(100 * time.Millisecond)
38
+ ticker := time.NewTicker(100 * time.Millisecond)
39
+ defer ticker.Stop()
40
41
for {
42
err := apis[1].PubSub().Publish(ctx, "testch", []byte("hello world"))
@@ -45,7 +46,7 @@ func (tp *provider) TestBasicPubSub(t *testing.T) {
46
return
47
}
48
select {
48
- case <-tick:
49
+ case <-ticker.C:
50
case <-ctx.Done():
51
return
52
}