projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show a proper error. A failure doesn't always mean the command isn't available, and...
[akkoma]
/
lib
/
pleroma
/
emoji
/
pack.ex
diff --git
a/lib/pleroma/emoji/pack.ex
b/lib/pleroma/emoji/pack.ex
index f768af19f7891a8b5be8c9520cf832eb9a66338a..09bfcc868006c8dc39b8fad10f0e2cf49fbf616f 100644
(file)
--- a/
lib/pleroma/emoji/pack.ex
+++ b/
lib/pleroma/emoji/pack.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-202
0
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-202
1
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emoji.Pack do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emoji.Pack do
@@
-20,6
+20,8
@@
defmodule Pleroma.Emoji.Pack do
name: String.t()
}
name: String.t()
}
+ @cachex Pleroma.Config.get([:cachex, :provider], Cachex)
+
alias Pleroma.Emoji
alias Pleroma.Emoji.Pack
alias Pleroma.Utils
alias Pleroma.Emoji
alias Pleroma.Emoji.Pack
alias Pleroma.Utils
@@
-415,7
+417,7
@@
defmodule Pleroma.Emoji.Pack do
ttl_per_file = Pleroma.Config.get!([:emoji, :shared_pack_cache_seconds_per_file])
overall_ttl = :timer.seconds(ttl_per_file * Enum.count(files))
ttl_per_file = Pleroma.Config.get!([:emoji, :shared_pack_cache_seconds_per_file])
overall_ttl = :timer.seconds(ttl_per_file * Enum.count(files))
-
Cachex.put!
(
+
@cachex.put
(
:emoji_packs_cache,
pack.name,
# if pack.json MD5 changes, the cache is not valid anymore
:emoji_packs_cache,
pack.name,
# if pack.json MD5 changes, the cache is not valid anymore
@@
-618,7
+620,7
@@
defmodule Pleroma.Emoji.Pack do
defp fetch_archive(pack) do
hash = :crypto.hash(:md5, File.read!(pack.pack_file))
defp fetch_archive(pack) do
hash = :crypto.hash(:md5, File.read!(pack.pack_file))
- case
C
achex.get!(:emoji_packs_cache, pack.name) do
+ case
@c
achex.get!(:emoji_packs_cache, pack.name) do
%{hash: ^hash, pack_data: archive} -> archive
_ -> create_archive_and_cache(pack, hash)
end
%{hash: ^hash, pack_data: archive} -> archive
_ -> create_archive_and_cache(pack, hash)
end