Skip to content

Commit bed8cfa

Browse files
committed
chore: update github.com/kelindar/async to v1.3.1 and refactor timing functions in benchmarks
1 parent 5aa9c9a commit bed8cfa

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.2
55
toolchain go1.24.4
66

77
require (
8-
github.com/kelindar/async v1.3.0
8+
github.com/kelindar/async v1.3.1
99
github.com/kelindar/s3 v0.0.3
1010
github.com/klauspost/compress v1.18.0
1111
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/RoaringBitmap/roaring v0.6.1 h1:O36Tdaj1Fi/zyr25shTHwlQPGdq53+u4WkM08
22
github.com/RoaringBitmap/roaring v0.6.1/go.mod h1:WZ83fjBF/7uBHi6QoFyfGL4+xuV4Qn+xFkm4+vSzrhE=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/kelindar/async v1.3.0 h1:mPBTJ/eXCKE+HHKfY1r68Wjo1KjSyArajlsipcSajEY=
6-
github.com/kelindar/async v1.3.0/go.mod h1:gaCq2zl7zDKjlPY05R45l/0hHgVkJxsfjR3X7sxxvDg=
5+
github.com/kelindar/async v1.3.1 h1:UL+s/40S/ikNxBkAiqLmtfgcrHxVdk2mvzYneJxc7Xg=
6+
github.com/kelindar/async v1.3.1/go.mod h1:gaCq2zl7zDKjlPY05R45l/0hHgVkJxsfjR3X7sxxvDg=
77
github.com/kelindar/s3 v0.0.3 h1:izXVdKkH7faO1vM+qQ1zSA9Y6L/8C8p2CkF/FIrnUa0=
88
github.com/kelindar/s3 v0.0.3/go.mod h1:O2/uN3efPfCUVNmNPHNBY242Bm7LIu+RHQ7bDU5iUXs=
99
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=

tales.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Service struct {
5252
metaLRU *cache.LRU[string, *codec.Metadata]
5353
commands chan command
5454
jobs chan async.Task[iter.Seq[codec.LogEntry]]
55-
consumer async.Task[iter.Seq[codec.LogEntry]]
55+
consumer async.Awaiter
5656
wg sync.WaitGroup
5757
cancel context.CancelFunc
5858
closed int32 // atomic flag
@@ -161,7 +161,7 @@ func (l *Service) Close() error {
161161

162162
// Stop worker pool
163163
close(l.jobs)
164-
l.consumer.Outcome()
164+
l.consumer.Wait()
165165

166166
// Signal the run loop to exit and wait for it to finish
167167
close(l.commands)

tales_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@ func BenchmarkLog(b *testing.B) {
2727

2828
count := 0
2929
start := time.Now()
30-
for time.Now().Sub(start) < time.Second {
30+
for time.Since(start) < time.Second {
3131
const interval = 50 * time.Millisecond
32-
for i := time.Now(); time.Now().Sub(i) < interval; {
32+
for i := time.Now(); time.Since(i) < interval; {
3333
logger.Log("hello world", 1)
3434
count++
3535
}
3636

3737
logger.flush()
3838
}
39-
40-
b.N = count
41-
b.ReportMetric(float64(count)/time.Now().Sub(start).Seconds(), "tps")
39+
b.ReportMetric(float64(count)/time.Since(start).Seconds(), "tps")
4240
}
4341

4442
/*
@@ -60,18 +58,17 @@ func BenchmarkQuery(b *testing.B) {
6058
b.ResetTimer()
6159
count := 0
6260
start := time.Now()
63-
for time.Now().Sub(start) < time.Second {
61+
for time.Since(start) < time.Second {
6462
const interval = 50 * time.Millisecond
65-
for i := time.Now(); time.Now().Sub(i) < interval; {
63+
for i := time.Now(); time.Since(i) < interval; {
6664
for range logger.Query(time.Now().Add(-1*time.Hour), time.Now().Add(1*time.Hour), 1) {
6765
// Consume the iterator
6866
}
6967
count++
7068
}
7169
}
7270

73-
b.N = count
74-
b.ReportMetric(float64(count)/time.Now().Sub(start).Seconds(), "qps")
71+
b.ReportMetric(float64(count)/time.Since(start).Seconds(), "qps")
7572
}
7673

7774
func TestIntegration(t *testing.T) {

0 commit comments

Comments
 (0)