From 1936075bc08563ebbcf1d0aec0cf68721d98f3a2 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Sun, 17 Nov 2024 21:35:06 +0000 Subject: [PATCH] Add API to refresh the LastFm feed --- lib/last_fm/refresh.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/last_fm/refresh.ex b/lib/last_fm/refresh.ex index e9741976..309874dc 100644 --- a/lib/last_fm/refresh.ex +++ b/lib/last_fm/refresh.ex @@ -17,6 +17,12 @@ defmodule LastFm.Refresh do GenServer.start_link(__MODULE__, config, name: __MODULE__) end + @spec refresh() :: :refresh + def refresh do + # Very barebones and naive - can be improved by building a state machine. + send(__MODULE__, :refresh) + end + @impl true @spec init(config) :: {:ok, config, {:continue, :refresh}} | :ignore def init(config) do