title: Elixir GenServer doesn't work with module attributes?
body: <p>I am setting up a GenServer that runs every hour to cache data. I followed the example José Valim posted is response to a question about how to do this.</p>
  
  <p><a href="https://stackoverflow.com/questions/32085258/how-to-run-some-code-every-few-hours-in-phoenix-framework">How to run some code every few hours in Phoenix framework?</a></p>
  
  <p>It works great except that if the interval I gave the call to <code>Process.send_after/3</code> is a module attribute it does not run. Does anyone have insights as to why this might be?</p>
  
  <p>So the following does not work but if in the calls to <code>Process.send_after/3</code> I replace <code>@interval</code> with <code>60 * 60 * 1000</code> it runs as expected (this is essentially the code from the other SO post above):</p>
  
  <pre><code>defmodule MyApp.Periodically do
    use GenServer
  
    def start_link do
      GenServer.start_link(__MODULE__, %{})
    end
  
    @interval 60 * 60 * 1000
  
    def init(state) do
      Process.send_after(self(), :work, @interval)
      {:ok, state}
    end
  
    def handle_info(:work, state) do
      # Begin caching the new data.
      MyApp.CacheManager.cache_new_data()
  
      # Start the timer again
      Process.send_after(self(), :work, @interval)
      {:noreply, state}
    end
  end
  </code></pre>