forked from AkkomaGang/akkoma
RichMedia parser: do not set a cache TTL for unchanging errors
This commit is contained in:
parent
2937e3095a
commit
f66a15c4a5
1 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,14 @@ defp get_cached_or_parse(url) do
|
||||||
{:ok, _data} = res ->
|
{:ok, _data} = res ->
|
||||||
res
|
res
|
||||||
|
|
||||||
|
{:error, :body_too_large} = e ->
|
||||||
|
e
|
||||||
|
|
||||||
|
{:error, {:content_type, _}} ->
|
||||||
|
e
|
||||||
|
|
||||||
|
# The TTL is not set for the errors above, since they are unlikely to change
|
||||||
|
# with time
|
||||||
{:error, _} = e ->
|
{:error, _} = e ->
|
||||||
ttl = Pleroma.Config.get([:rich_media, :failure_backoff], 60_000)
|
ttl = Pleroma.Config.get([:rich_media, :failure_backoff], 60_000)
|
||||||
Cachex.expire(:rich_media_cache, url, ttl)
|
Cachex.expire(:rich_media_cache, url, ttl)
|
||||||
|
|
Loading…
Reference in a new issue