Limit expirations for each cron execution to 50.
authorMark Felder <feld@FreeBSD.org>
Sat, 8 Aug 2020 17:49:02 +0000 (12:49 -0500)
committerMark Felder <feld@FreeBSD.org>
Sat, 8 Aug 2020 17:49:02 +0000 (12:49 -0500)
This should prevent servers from being crushed. 50/min is a pretty good rate.

lib/pleroma/activity_expiration.ex

index 7cc9668b373cc252cf0f42d812cc459e4c321324..84edf68ef3e3f20a20bc3169ac9a3b4639d253cd 100644 (file)
@@ -46,6 +46,7 @@ defmodule Pleroma.ActivityExpiration do
 
     ActivityExpiration
     |> where([exp], exp.scheduled_at < ^naive_datetime)
+    |> limit(50)
     |> Repo.all()
   end