Skip to content

Commit e20d688

Browse files
committed
bench_test: modify bench test to restart decayed log
1 parent 5a2e687 commit e20d688

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

bench_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ func BenchmarkProcessPacket(b *testing.B) {
7070
for i := 0; i < b.N; i++ {
7171
pkt, err = path[0].ProcessOnionPacket(sphinxPacket, nil)
7272
if err != nil {
73-
b.Fatalf("unable to process packet: %v", err)
73+
b.Fatalf("unable to process packet %d: %v", i, err)
7474
}
7575

7676
b.StopTimer()
77-
shutdown("0", path[0].log)
77+
router := path[0]
78+
shutdown("0", router.log)
79+
path[0] = &Router{
80+
nodeID: router.nodeID,
81+
nodeAddr: router.nodeAddr,
82+
onionKey: router.onionKey,
83+
log: NewDecayedLog("0", nil),
84+
}
7885
path[0].log.Start()
7986
b.StartTimer()
8087
}

0 commit comments

Comments
 (0)