Skip to content

Commit 7e08809

Browse files
committed
Cleanup
Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 650729b commit 7e08809

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

chainexchange/pubsub.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package chainexchange
33
import (
44
"context"
55
"fmt"
6-
"runtime"
76
"sync"
87
"sync/atomic"
98
"time"
@@ -265,11 +264,10 @@ func (p *PubSubChainExchange) cacheAsDiscoveredChain(ctx context.Context, cmsg M
265264
wanted := p.getChainsDiscoveredAt(ctx, cmsg.Instance)
266265
discovered := p.getChainsDiscoveredAt(ctx, cmsg.Instance)
267266

268-
keysBatch := cmsg.Chain.KeysForPrefixes()
267+
//keysBatch := cmsg.Chain.KeysForPrefixes()
269268
for offset := cmsg.Chain.Len() - 1; offset >= 0 && ctx.Err() == nil; offset-- {
270269
prefix := cmsg.Chain.Prefix(offset)
271270
//key := keysBatch[offset]
272-
runtime.KeepAlive(keysBatch)
273271
key := prefix.Key()
274272

275273
if portion, found := wanted.Peek(key); !found {
@@ -336,15 +334,13 @@ func (p *PubSubChainExchange) cacheAsWantedChain(ctx context.Context, cmsg Messa
336334
var notifications []discovery
337335
wanted := p.getChainsWantedAt(ctx, cmsg.Instance)
338336
//keysBatch := cmsg.Chain.KeysForPrefixes()
339-
//keysBatch := cmsg.Chain.KeysForPrefixes()
337+
time.Sleep(5 * time.Millisecond)
340338
fmt.Println(cmsg.Chain.Len())
341-
time.Sleep(10 * time.Millisecond)
342339

343340
for offset := cmsg.Chain.Len() - 1; offset >= 0 && ctx.Err() == nil; offset-- {
344341
prefix := cmsg.Chain.Prefix(offset)
345342
//key := keysBatch[offset]
346343
key := prefix.Key()
347-
//runtime.KeepAlive(keysBatch)
348344

349345
if portion, found := wanted.Peek(key); !found || portion.IsPlaceholder() {
350346
wanted.Add(key, &chainPortion{

f3_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
eventualCheckTimeout = time.Minute
3333
manifestPublishInterval = 100 * time.Millisecond
3434
advanceClockEvery = 5 * time.Millisecond
35-
advanceClockBy = 100 * time.Millisecond
35+
advanceClockBy = 50 * time.Millisecond
3636
)
3737

3838
func init() {

0 commit comments

Comments
 (0)