fix: remove duplicate handle_info and schedule_cleanup function definitions in AgentCache (#162)

Removed duplicate function definitions that were causing compile warnings:
- handle_info(:cleanup_expired, state) was defined twice (lines 94 and 110)
- schedule_cleanup/0 was defined twice (lines 105 and 121)

The duplicate definitions at lines 110-124 were exact copies and have been removed.

Reviewed-on: graham/towerops-web#162
This commit is contained in:
Graham McIntire 2026-03-25 10:18:11 -05:00 committed by graham
parent f0fe3c025c
commit 4b6538df8e

View file

@ -105,21 +105,4 @@ defmodule Towerops.Agents.AgentCache do
defp schedule_cleanup do
Process.send_after(self(), :cleanup_expired, 60_000)
end
@impl GenServer
def handle_info(:cleanup_expired, state) do
now = System.monotonic_time(:millisecond)
# Delete all device cache entries that have expired
:ets.select_delete(@table, [
{{{:device, :_}, :_, :"$1"}, [{:<, :"$1", now}], [true]}
])
schedule_cleanup()
{:noreply, state}
end
defp schedule_cleanup do
# Run cleanup every minute
Process.send_after(self(), :cleanup_expired, 60_000)
end
end