handle bad tweaks val

f37399e · gmorell · 2023-02-16 17:36

6 files +5 -1

Files changed

modified apps/room_sanctum/lib/room_sanctum/workers/pythiae_worker.ex
+5 −1
@@ -59,7 +59,11 @@ defmodule RoomSanctum.Worker.Pythiae do
59 59 current = RoomSanctum.Worker.Vision.get_state(state.pythiae.curr_vision)
60 60 cfg_ttl = case state.pythiae do
61 61 nil -> 0
62 − _val -> state.pythiae.tweaks |> Map.from_struct |> Map.get(:ttl, 0) || 0
62 + _val -> case state.pythiae.tweaks do
63 + nil -> 0
64 + val -> state.pythiae.tweaks |> Map.from_struct |> Map.get(:ttl, 0) || 0
65 + end
66 +
63 67 end
64 68 comparison = DateTime.add(state.lastpub, cfg_ttl, :second)
65 69 if current != state.vision and DateTime.compare(DateTime.utc_now, comparison) == :gt do

Parents: c420344