use another stream function in migration

This commit is contained in:
Alexander Strizhakov 2020-09-03 18:08:19 +03:00 committed by rinpatch
parent 357d971a10
commit 6f2d114518

View File

@ -12,9 +12,8 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
from(e in "activity_expirations",
select: %{id: e.id, activity_id: e.activity_id, scheduled_at: e.scheduled_at}
)
|> Pleroma.RepoStreamer.chunk_stream(500)
|> Stream.each(fn expirations ->
Enum.each(expirations, fn expiration ->
|> Pleroma.Repo.stream()
|> Enum.each(fn expiration ->
with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
activity_id: FlakeId.to_string(expiration.activity_id),
@ -23,7 +22,6 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
})
end
end)
end)
|> Stream.run()
end
end