Skip to content

Commit 976f7cd

Browse files
fix: CI
1 parent 9e230f8 commit 976f7cd

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

lib/cesium_link/links.ex

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,26 @@ defmodule CesiumLink.Links do
6464
6565
"""
6666
def list_unarchived_links_by_index do
67-
case CesiumLink.Standalone.get("links") do
68-
nil ->
67+
case safe_get_from_redis("links") do
68+
{:ok, nil} ->
6969
links = list_unarchived_links_by_index_from_db()
7070
CesiumLink.Standalone.put("links", links)
7171
links
7272

73-
links ->
73+
{:ok, links} ->
7474
links
75+
76+
{:error, _reason} ->
77+
list_unarchived_links_by_index_from_db()
78+
end
79+
end
80+
81+
defp safe_get_from_redis(key) do
82+
try do
83+
{:ok, CesiumLink.Standalone.get(key)}
84+
rescue
85+
exception ->
86+
{:error, exception}
7587
end
7688
end
7789

lib/cesium_link/redis_cache.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
defmodule CesiumLink.Standalone do
2+
@moduledoc """
3+
Standalone redis cache.
4+
"""
25
use Nebulex.Cache,
36
otp_app: :safira,
47
adapter: NebulexRedisAdapter

0 commit comments

Comments
 (0)