Commit 3fd27954 authored by Maksim's avatar Maksim

fix purge script

parent 64b7b0ee
Pipeline #26753 passed with stages
in 8 minutes and 18 seconds
......@@ -13,7 +13,7 @@ CACHE_DIRECTORY="/tmp/pleroma-media-cache"
## $3 - (optional) the number of parallel processes to run for grep.
get_cache_files() {
local max_parallel=${3-16}
find $2 -maxdepth 2 -type d | xargs -P $max_parallel -n 1 grep -E Rl "^KEY:.*$1" | sort -u
find $2 -maxdepth 2 -type d | xargs -P $max_parallel -n 1 grep -E -Rl "^KEY:.*$1" | sort -u
}
## Removes an item from the given cache zone.
......@@ -33,8 +33,9 @@ purge() {
do
echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
purge_item $url $CACHE_DIRECTORY
echo "\n"
done
}
purge $1
purge $@
......@@ -302,7 +302,7 @@ defp do_create(%{to: to, actor: actor, context: context, object: object} = param
:ok <- maybe_federate(activity) do
{:ok, activity}
else
{type, true, activity} when type in [:fake, :quick_insert] ->
{error, true, activity} when error in [:fake, :quick_insert] ->
{:ok, activity}
{:error, message} ->
......
......@@ -75,7 +75,7 @@ defp delete_objects([_ | _] = object_ids) do
defp delete_objects(_), do: :ok
defp cache_purge(true, urls), do: MediaProxy.Invalidation.purge(urls)
defp cache_purge(true, [_ | _] = urls), do: MediaProxy.Invalidation.purge(urls)
defp cache_purge(_, _), do: :ok
defp lock_attachments(true, urls), do: MediaProxy.put_in_deleted_urls(urls)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment