Properly handle un-needed background jobs
Cancel them if they're not needed Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
c68c0c2120
commit
770a518ad1
|
@ -69,7 +69,11 @@ defmodule Mobilizon.Service.Workers.Notification do
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
_ -> :ok
|
%Page{elements: [], total: 0} ->
|
||||||
|
{:cancel, :no_user_participations}
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -103,6 +107,9 @@ defmodule Mobilizon.Service.Workers.Notification do
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
|
%Page{elements: [], total: 0} ->
|
||||||
|
{:cancel, :no_user_participations}
|
||||||
|
|
||||||
_err ->
|
_err ->
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
@ -128,6 +135,9 @@ defmodule Mobilizon.Service.Workers.Notification do
|
||||||
{:error, :event_not_found} ->
|
{:error, :event_not_found} ->
|
||||||
{:cancel, :event_participation_not_found}
|
{:cancel, :event_participation_not_found}
|
||||||
|
|
||||||
|
%Page{elements: [], total: 0} ->
|
||||||
|
{:cancel, :no_participants_to_approve}
|
||||||
|
|
||||||
err ->
|
err ->
|
||||||
Logger.debug(inspect(err))
|
Logger.debug(inspect(err))
|
||||||
err
|
err
|
||||||
|
|
Loading…
Reference in a new issue