diff options
| author | Roman Chvanikov <chvanikoff@pm.me> | 2020-05-09 11:43:31 +0300 | 
|---|---|---|
| committer | Roman Chvanikov <chvanikoff@pm.me> | 2020-05-09 11:43:31 +0300 | 
| commit | 01b06d6dbfdeff7e1733d575fb94eee4dafbb56a (patch) | |
| tree | c0be73bbb0737ae04d25de0dd18731cc266bbfd6 /lib/mix | |
| parent | 942093683a1e6b3f3d3692268b2af8390da6d325 (diff) | |
| download | pleroma-01b06d6dbfdeff7e1733d575fb94eee4dafbb56a.tar.gz pleroma-01b06d6dbfdeff7e1733d575fb94eee4dafbb56a.zip | |
Show progress in refresh_counter_cache task
Diffstat (limited to 'lib/mix')
| -rw-r--r-- | lib/mix/tasks/pleroma/refresh_counter_cache.ex | 19 | 
1 files changed, 13 insertions, 6 deletions
| diff --git a/lib/mix/tasks/pleroma/refresh_counter_cache.ex b/lib/mix/tasks/pleroma/refresh_counter_cache.ex index 280201bef..b44e2545d 100644 --- a/lib/mix/tasks/pleroma/refresh_counter_cache.ex +++ b/lib/mix/tasks/pleroma/refresh_counter_cache.ex @@ -17,14 +17,21 @@ defmodule Mix.Tasks.Pleroma.RefreshCounterCache do    def run([]) do      Mix.Pleroma.start_pleroma() -    Activity -    |> distinct([a], true) -    |> select([a], fragment("split_part(?, '/', 3)", a.actor)) -    |> Repo.all() -    |> Enum.each(fn instance -> +    instances = +      Activity +      |> distinct([a], true) +      |> select([a], fragment("split_part(?, '/', 3)", a.actor)) +      |> Repo.all() + +    instances +    |> Enum.with_index(1) +    |> Enum.each(fn {instance, i} ->        counters = instance_counters(instance)        CounterCache.set(instance, counters) -      Mix.Pleroma.shell_info("Setting #{instance} counters: #{inspect(counters)}") + +      Mix.Pleroma.shell_info( +        "[#{i}/#{length(instances)}] Setting #{instance} counters: #{inspect(counters)}" +      )      end)      Mix.Pleroma.shell_info("Done") | 
