channable / opnieuw

One weird trick to make your code more reliable
https://tech.channable.com/posts/2020-02-05-opnieuw.html
BSD 3-Clause "New" or "Revised" License
289 stars 11 forks source link

Raise a ``UserWarning`` when ``max_calls_total < 2`` #31

Closed DanielNoord closed 11 months ago

DanielNoord commented 11 months ago

And also fix the date in the Changelog of 3.0.0.

jochemb commented 11 months ago

There is a good use case for max_calls_total = 1 though. People use dynamic globals to prevent retry behavior in their tests. This was explicitly added as a feature in https://github.com/channable/opnieuw/pull/3

So I don't think we want to limit usage in this way :/

DanielNoord commented 11 months ago

There is a good use case for max_calls_total = 1 though. People use dynamic globals to prevent retry behavior in their tests. This was explicitly added as a feature in #3

So I don't think we want to limit usage in this way :/

They can also disable erroring out on this UserWarning then right? Since it's a warning it won't crash the code.

DanielNoord commented 11 months ago

@jochemb A UserWarning does show up during normal execution but does not count as an Exception. It's more like a logging statement.

We could consider using just Warning, but I don't really know what's best. It feels like UserWarning fits best with our intention here.

DanielNoord commented 11 months ago

@OpsBotPrime merge

OpsBotPrime commented 11 months ago

Pull request approved for merge by @DanielNoord, rebasing now.

OpsBotPrime commented 11 months ago

Rebased as f558ae6994d0371b7c54db29b554893e243eb2c5, waiting for CI …

OpsBotPrime commented 11 months ago

CI job :yellow_circle: started.