receiver_worker: log processes crashes

Oban cataches crashes to handle job failure and retry,
thus it never bubbles up all the way and nothing is logged by default.
For better debugging, catch and log any crashes.
This commit is contained in:
Oneric 2024-12-15 02:50:20 +01:00
parent 8fa51700d4
commit 4701aa2a38

View file

@ -50,5 +50,13 @@ def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
Logger.error("Unexpected AP doc error: (raw) #{inspect(e)} from #{inspect(params)}") Logger.error("Unexpected AP doc error: (raw) #{inspect(e)} from #{inspect(params)}")
{:error, e} {:error, e}
end end
rescue
err ->
Logger.error(
"Receiver worker CRASH on #{inspect(params)} with: #{Exception.format(:error, err, __STACKTRACE__)}"
)
# reraise to let oban handle transaction conflicts without deductig an attempt
reraise err, __STACKTRACE__
end end
end end