oban-bg / oban

💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3
https://oban.pro
Apache License 2.0
3.37k stars 313 forks source link

Unclear docs for `perform/1` callback in case of an unhandled exception, exit or throw #1045

Closed drobnyd closed 9 months ago

drobnyd commented 9 months ago

Hello, I was attempting to determine what happens with a job when it encounters an exception, specifically whether it will be re-queued and count towards the maximum attempts. However, I was not able to clarify this from the documentation, which states:

In addition to explicit return values, any unhandled exception, exit or throw will fail the job and schedule a retry under the same conditions as in the {:error, error} case.

Upon examining the code, it appears that the attempt count is incremented and the job is retried as long as the max_attempts count has not been reached.

If this understanding is correct, may I suggest clarifying the documentation to specifically reference the {:error, error} case, which is very clear?

I have drafted a suggestion regarding this clarification: https://github.com/sorentwo/oban/pull/1044 Let me know if it sounds good to you!

sorentwo commented 9 months ago

The linked PR looks good. I'm closing this issue in favor of that PR.