File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -343,13 +343,16 @@ defmodule Keila.Mailings do
343
343
@ spec deliver_campaign ( Campaign . id ( ) ) :: { :error , :no_recipients } | { :error , term ( ) } | :ok
344
344
def deliver_campaign ( id ) when is_id ( id ) do
345
345
result =
346
- Repo . transaction ( fn ->
347
- case get_and_lock_campaign ( id ) do
348
- % Campaign { sent_at: sent_at } when not is_nil ( sent_at ) -> Repo . rollback ( :already_sent )
349
- % Campaign { sender_id: nil } -> Repo . rollback ( :no_sender )
350
- campaign = % Campaign { } -> do_deliver_campaign ( campaign )
351
- end
352
- end )
346
+ Repo . transaction (
347
+ fn ->
348
+ case get_and_lock_campaign ( id ) do
349
+ % Campaign { sent_at: sent_at } when not is_nil ( sent_at ) -> Repo . rollback ( :already_sent )
350
+ % Campaign { sender_id: nil } -> Repo . rollback ( :no_sender )
351
+ campaign = % Campaign { } -> do_deliver_campaign ( campaign )
352
+ end
353
+ end ,
354
+ timeout: 60_000
355
+ )
353
356
354
357
case result do
355
358
{ :ok , _n } ->
You can’t perform that action at this time.
0 commit comments