Skip to content

Commit

Permalink
fix wait_time docs, tests for trigger deadline greater than or equal …
Browse files Browse the repository at this point in the history
…to wait deadline

Signed-off-by: redwrasse <[email protected]>
  • Loading branch information
redwrasse committed Jul 27, 2024
1 parent 9f59ef8 commit 5f782c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/wait/wait_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import "sync"
type WaitTime interface {
// Wait returns a chan that waits on the given logical deadline.
// The chan will be triggered when Trigger is called with a
// deadline that is later than the one it is waiting for.
// deadline that is later than or equal to the one it is waiting for.
Wait(deadline uint64) <-chan struct{}
// Trigger triggers all the waiting chans with an earlier logical deadline.
// Trigger triggers all the waiting chans with an equal or earlier logical deadline.
Trigger(deadline uint64)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/wait/wait_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestWaitTestStress(t *testing.T) {
for i := 0; i < 10000; i++ {
chs = append(chs, wt.Wait(uint64(i)))
}
wt.Trigger(10000 + 1)
wt.Trigger(10000 - 1)

for _, ch := range chs {
select {
Expand All @@ -81,6 +81,6 @@ func BenchmarkTriggerAnd10KWaitTime(b *testing.B) {
for j := 0; j < 10000; j++ {
wt.Wait(uint64(j))
}
wt.Trigger(10000 + 1)
wt.Trigger(10000 - 1)
}
}

0 comments on commit 5f782c3

Please sign in to comment.