Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] minor issue with error handling in two Oban jobs #304

Closed
seth-schroeder opened this issue Jun 13, 2023 · 0 comments · Fixed by #305 · May be fixed by #306
Closed

[BUG] minor issue with error handling in two Oban jobs #304

seth-schroeder opened this issue Jun 13, 2023 · 0 comments · Fixed by #305 · May be fixed by #306

Comments

@seth-schroeder
Copy link
Contributor

Story

Hello! I was testing a custom Credo check and it reported a warning with two Oban workers in this project:

seth-schroeder@ubuntu:~/src/elixir/backend$ mix credo
Checking 180 source files (this might take a while) ...

  Warnings - please take a look
┃
┃ [W] → Potential false negative on Multi error handling in an Oban job
┃       lib/cambiatus/workers/monthly_digest_worker.ex:24 #(Cambiatus.Workers.MonthlyDigestWorker.perform)
┃ [W] → Potential false negative on Multi error handling in an Oban job
┃       lib/cambiatus/workers/contribution_paypal_worker.ex:38 #(Cambiatus.Workers.ContributionPaypalWorker.digest_payment_callback)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.9 seconds (0.1s to load, 0.7s running 53 checks on 180 files)
847 mods/funs, found 2 warnings.

The warning has to do with returning a 4 tuple error from perform. Oban accepts only 2 tuple errors. When Multi.new is part of a Repo.transaction, 4 tuple errors are generated. The 4 tuple errors are interpreted as successes by Oban.

If you are interested, there are more details in the links section.

I was going to submit two PRs for consideration:

  • updated error handling in the two workers
  • same as above, but with the credo check

Links

https://github.com/seth-schroeder/credo_check_error_handling_ecto_oban#credocheckerrorhandlingectooban
https://hex.pm/packages/credo_check_error_handling_ecto_oban

seth-schroeder added a commit to seth-schroeder/backend that referenced this issue Jun 13, 2023
seth-schroeder added a commit to seth-schroeder/backend that referenced this issue Jun 13, 2023
lucca65 pushed a commit that referenced this issue Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant