[#3259] MediaTableMigrator: state clearance on job restart.

This commit is contained in:
Ivan Tashkinov 2021-01-28 22:52:01 +03:00
parent 4b10d15e62
commit 90c60993c1
2 changed files with 6 additions and 0 deletions

View File

@ -72,6 +72,8 @@ defmodule Pleroma.Migrators.MediaTableMigrator do
@impl true @impl true
def handle_info(:process_attachments, state) do def handle_info(:process_attachments, state) do
State.clear()
data_migration = data_migration() data_migration = data_migration()
persistent_data = Map.take(data_migration.data, ["max_processed_id"]) persistent_data = Map.take(data_migration.data, ["max_processed_id"])

View File

@ -12,6 +12,10 @@ defmodule Pleroma.Migrators.MediaTableMigrator.State do
Agent.start_link(fn -> @init_state end, name: @reg_name) Agent.start_link(fn -> @init_state end, name: @reg_name)
end end
def clear do
Agent.update(@reg_name, fn _state -> @init_state end)
end
def get do def get do
Agent.get(@reg_name, & &1) Agent.get(@reg_name, & &1)
end end