Limit expirations for each cron execution to 50.
This should prevent servers from being crushed. 50/min is a pretty good rate.
This commit is contained in:
parent
761cc5b4a2
commit
e08ea01d09
|
@ -46,6 +46,7 @@ def due_expirations(offset \\ 0) do
|
||||||
|
|
||||||
ActivityExpiration
|
ActivityExpiration
|
||||||
|> where([exp], exp.scheduled_at < ^naive_datetime)
|
|> where([exp], exp.scheduled_at < ^naive_datetime)
|
||||||
|
|> limit(50)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue