jonboulle / clockwork

a fake clock for golang
Apache License 2.0
656 stars 58 forks source link

Add BlockUntilContext, which respects context cancellation. #56

Closed DPJacques closed 1 year ago

DPJacques commented 1 year ago

BlockUntil is easy to misjudge and when callers get that wrong, the test blocks forever and eventually times out.

Also deletes notifyBlockers and its test, inlining this function at its only call point.

DPJacques commented 1 year ago

Hey @sagikazarmark, could I get your thoughts on this change?

DPJacques commented 1 year ago

Just a friendly ping for any of the maintainers.

@sagikazarmark or @jonboulle, would anyone mind taking a look?

DPJacques commented 1 year ago

Responded to the NITs, I think I need clarification on the TestNotifyBlockers comment, however. Please let me know how you'd like to handle that. Sorry if I added too many things to 1 PR.

zmb3 commented 3 months ago

How is one supposed to actually use BlockUntilContext() if it's not part of the FakeClock interface? Am I missing something?