forked from AkkomaGang/akkoma
use another stream function in migration
This commit is contained in:
parent
357d971a10
commit
6f2d114518
1 changed files with 9 additions and 11 deletions
|
@ -12,9 +12,8 @@ def change do
|
||||||
from(e in "activity_expirations",
|
from(e in "activity_expirations",
|
||||||
select: %{id: e.id, activity_id: e.activity_id, scheduled_at: e.scheduled_at}
|
select: %{id: e.id, activity_id: e.activity_id, scheduled_at: e.scheduled_at}
|
||||||
)
|
)
|
||||||
|> Pleroma.RepoStreamer.chunk_stream(500)
|
|> Pleroma.Repo.stream()
|
||||||
|> Stream.each(fn expirations ->
|
|> Enum.each(fn expiration ->
|
||||||
Enum.each(expirations, fn expiration ->
|
|
||||||
with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
|
with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
|
||||||
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||||
activity_id: FlakeId.to_string(expiration.activity_id),
|
activity_id: FlakeId.to_string(expiration.activity_id),
|
||||||
|
@ -23,7 +22,6 @@ def change do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue