defmodule DaProductApp.Transactions.Watchdog do @moduledoc """ Periodic job to process scheduled follow-up requests (ChkTxn / Reversal) timeouts. """ use GenServer alias DaProductApp.Transactions.Service @interval_ms 5_000 def start_link(opts), do: GenServer.start_link(__MODULE__, opts, name: __MODULE__) @impl true def init(state) do schedule() {:ok, state} end @impl true def handle_info(:tick, state) do Service.process_expired_followups() schedule() {:noreply, state} end defp schedule, do: Process.send_after(self(), :tick, @interval_ms) end