From 4b6538df8ed0c05f6ce775762b3eb8748525b5b3 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 25 Mar 2026 10:18:11 -0500 Subject: [PATCH] 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: https://git.mcintire.me/graham/towerops-web/pulls/162 --- lib/towerops/agents/agent_cache.ex | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/towerops/agents/agent_cache.ex b/lib/towerops/agents/agent_cache.ex index c5651387..4dd4b864 100644 --- a/lib/towerops/agents/agent_cache.ex +++ b/lib/towerops/agents/agent_cache.ex @@ -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