Add appropriate timeouts for Repo.transactions
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
90158f1112
commit
87214b038f
@ -64,7 +64,7 @@ defmodule Mobilizon.Service.ActorSuspension do
|
||||
|
||||
Logger.debug("Going to run the transaction")
|
||||
|
||||
case Repo.transaction(multi) do
|
||||
case Repo.transaction(multi, timeout: 60_000) do
|
||||
{:ok, %{actor: %Actor{} = actor}} ->
|
||||
{:ok, true} = Cachex.del(:activity_pub, "actor_#{actor.preferred_username}")
|
||||
Cachable.clear_all_caches(actor)
|
||||
|
@ -29,7 +29,8 @@ defmodule Mobilizon.Service.SiteMap do
|
||||
gzip: false
|
||||
]
|
||||
|
||||
Repo.transaction(fn ->
|
||||
Repo.transaction(
|
||||
fn ->
|
||||
Events.stream_events_for_sitemap()
|
||||
|> Stream.concat(Actors.list_groups_for_stream())
|
||||
|> Stream.concat(Posts.list_posts_for_stream())
|
||||
@ -57,7 +58,9 @@ defmodule Mobilizon.Service.SiteMap do
|
||||
|> Sitemapper.persist(config)
|
||||
|> Sitemapper.ping(config)
|
||||
|> Stream.run()
|
||||
end)
|
||||
end,
|
||||
timeout: :infinity
|
||||
)
|
||||
end
|
||||
|
||||
# Sometimes we use naive datetimes
|
||||
|
@ -20,7 +20,8 @@ defmodule Mobilizon.Service.Workers.SendActivityRecapWorker do
|
||||
|
||||
@impl Oban.Worker
|
||||
def perform(%Job{}) do
|
||||
Repo.transaction(fn ->
|
||||
Repo.transaction(
|
||||
fn ->
|
||||
Users.stream_users_for_recap()
|
||||
|> Enum.to_list()
|
||||
|> Repo.preload([:settings, :activity_settings])
|
||||
@ -40,7 +41,9 @@ defmodule Mobilizon.Service.Workers.SendActivityRecapWorker do
|
||||
} ->
|
||||
Email.send(user, activities, recap: group_notifications)
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
timeout: :infinity
|
||||
)
|
||||
end
|
||||
|
||||
defp activities_for_user(
|
||||
|
@ -82,7 +82,8 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
|> MapSet.new()
|
||||
|
||||
if MapSet.size(diff) > 0 do
|
||||
Repo.transaction(fn ->
|
||||
Repo.transaction(
|
||||
fn ->
|
||||
event_id
|
||||
|> Events.list_local_emails_user_participants_for_event_query()
|
||||
|> Repo.stream()
|
||||
@ -90,7 +91,9 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
|> Enum.each(
|
||||
&send_notification_for_event_update_to_participant(&1, old_event, event, diff)
|
||||
)
|
||||
end)
|
||||
end,
|
||||
timeout: 120_000
|
||||
)
|
||||
else
|
||||
{:ok, :ok}
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user