Only refresh groups that need updating

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-02 14:48:59 +01:00
parent 74e0e009d1
commit e70b21ae79
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -100,6 +100,7 @@ defmodule Mobilizon.Federation.ActivityPub.Refresher do
def refresh_all_external_groups do def refresh_all_external_groups do
Repo.transaction(fn -> Repo.transaction(fn ->
Actors.list_external_groups_for_stream() Actors.list_external_groups_for_stream()
|> Stream.filter(&Actors.needs_update?/1)
|> Stream.map(&refresh_profile/1) |> Stream.map(&refresh_profile/1)
|> Stream.run() |> Stream.run()
end) end)