How to supervise Process.send_after

Hi, I have a simple genserver, when it is started I send an atom to handle_info every 100 millisecond

like this:

  def init(state) do
    Logger.info("OTP UpdateChecker server was started")
    {:ok, state, {:continue, :start_task}}
  end

  def handle_continue(:start_task, state) do
    Process.send_after(self(), :check_update, @update_check_time)
    {:noreply, state}
  end

  def handle_info(:check_update, state) do
    Logger.info("OTP UpdateChecker check update tasks were sent.")
    Process.send_after(self(), :check_update, @update_check_time)
    {:noreply, state}
  end

When my application is in developer mode and if a user run recompile, the Process.send_after does not send anymore.

So how can I check it to work after a recompiling, It happens when the time of send_after is lower than recompile time

Thank you

1 Like

Recompile in development mode is a dump “recompile” a.k.a. less sophisticated than a release hot code update and not really meant to handle every case. Generally I’d suggest restarting your server if you modify stateful code / processes.

Yes, I know, I do not want to find a way to hot code or sth in developer mod. I curious there is an option after recompiling it and after that restart the application module automatically or not.
I am researching as my previous posts to prepare my library. I want to consider all the situations.

Thank you