You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do a quick search and make sure the bug has not yet been reported
For support, favor using the Elixir Forum, Slack, IRC, etc.
Be friendly and polite!
Environment
Oban 2.17.11
PostgreSQL: 12.16
Elixir: 1.16.3 (compiled with Erlang/OTP 26)
OTP: 26
Current Behavior
Hey!
I have this simplified version of a worker on my project. The important part is the create method:
defmoduleWorkerdouseOban.Worker,queue: :index,unique: [# for the next 2 seconds, starting on job's insertion timeperiod: 2,# check for each incoming job, whether or not worker and args are the samefields: [:args,:worker],# from the args, use id, action and resourcekeys: [:id,:action,:resource],states: [:available,:scheduled]# then, replace the current persisted job `scheduled_at` by the incoming job.scheduled_at# replace: [scheduled: [:scheduled_at]]]requireLogger@speccreate(number)::{:ok,Oban.Job.t()}|{:error,any}defcreate(id)do%{id: id}|>new(replace: [scheduled: [:scheduled_at]],schedule_in: 1)|>Oban.insert()|>casedo{:ok,job}->{:ok,job}{:error,error}->Logger.notice("Failed to create Worker job for '#{id}': #{inspect(error)}"){:error,error}endendend
Recently we've improved our visibility and started sending all sort of errors to Sentry. After that we started seeing a ton of errors
on the case statement within create similar to (I've unwrapped the error in a more legible format):
According to Oban's doc and typespec Oban.insert/1 should never return anything other than {:ok, job} or {:error, error} which makes this behavior odd. After looking at 400+ errors the only thing in common they have is the conflict?: true flag, so after reading throughout Oban's source code I came across this line which seems to be returning only the job and only when a conflict happens. And since this line was changed a couple of days ago I believe this might be a regression.
Expected Behavior
Oban.insert() should only return {:ok, job} or {:error, error}.
The text was updated successfully, but these errors were encountered:
Thanks @michelboaventura, that was indeed a regression. Dialyzer didn't help here and that condition is prohibitively difficult to replicate in tests because of the sandbox.
Precheck
Environment
Current Behavior
Hey!
I have this simplified version of a worker on my project. The important part is the
create
method:Recently we've improved our visibility and started sending all sort of errors to Sentry. After that we started seeing a ton of errors
on the
case
statement withincreate
similar to (I've unwrapped the error in a more legible format):According to Oban's doc and typespec
Oban.insert/1
should never return anything other than{:ok, job}
or{:error, error}
which makes this behavior odd. After looking at 400+ errors the only thing in common they have is theconflict?: true
flag, so after reading throughout Oban's source code I came across this line which seems to be returning only the job and only when a conflict happens. And since this line was changed a couple of days ago I believe this might be a regression.Expected Behavior
Oban.insert()
should only return{:ok, job}
or{:error, error}
.The text was updated successfully, but these errors were encountered: