Skip to content

Commit

Permalink
fix: CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRodrigues10 committed Jan 22, 2025
1 parent 9e230f8 commit 976f7cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/cesium_link/links.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,26 @@ defmodule CesiumLink.Links do
"""
def list_unarchived_links_by_index do
case CesiumLink.Standalone.get("links") do
nil ->
case safe_get_from_redis("links") do
{:ok, nil} ->
links = list_unarchived_links_by_index_from_db()
CesiumLink.Standalone.put("links", links)
links

links ->
{:ok, links} ->
links

{:error, _reason} ->
list_unarchived_links_by_index_from_db()
end
end

defp safe_get_from_redis(key) do
try do

Check warning on line 82 in lib/cesium_link/links.ex

View workflow job for this annotation

GitHub Actions / Code Quality (26.x, 1.14.x)

Prefer using an implicit `try` rather than explicit `try`.
{:ok, CesiumLink.Standalone.get(key)}
rescue
exception ->
{:error, exception}
end
end

Expand Down
3 changes: 3 additions & 0 deletions lib/cesium_link/redis_cache.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
defmodule CesiumLink.Standalone do
@moduledoc """
Standalone redis cache.
"""
use Nebulex.Cache,
otp_app: :safira,
adapter: NebulexRedisAdapter
Expand Down

0 comments on commit 976f7cd

Please sign in to comment.