Skip to content

Commit 4ef26f8

Browse files
committed
campaign example: Actually wait for renewal
1 parent d071453 commit 4ef26f8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

campaign_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ func ExampleConfig_Acquire() {
771771
<-electedCh
772772
fc.Advance(c.TermLength / 2)
773773

774+
// Wait for the lease renewal to happen before cancelling (so the
775+
// output is predictable)
776+
fc.AwaitSleepers(1)
777+
774778
cancel()
775779
// Acquire blocks until all callbacks return (there's an internal WaitGroup)
776780
<-acquireCh

0 commit comments

Comments
 (0)