From 6f2d1145183389c415e4d5a915e0c3965c00a3fb Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 3 Sep 2020 18:08:19 +0300 Subject: [PATCH] use another stream function in migration --- ...1316_move_activity_expirations_to_oban.exs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs b/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs index 585d1a600..2bfefceb0 100644 --- a/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs +++ b/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs @@ -12,17 +12,15 @@ def change 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 -> - 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), - expires_at: expires_at, - validate: false - }) - end - end) + |> 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), + expires_at: expires_at, + validate: false + }) + end end) |> Stream.run() end