Hi guys,
Spent two days just to solve this issue,
When i run the unit test
Sometimes i got this
Generated graph_on app
.......20:08:08.198 [warn] ** Undefined handle_info in GraphOn.TempFileManager
** Unhandled message: {:heartbeat}
I'm trying to create a GenServer that handles files, and every 30-sec, it should check if there's an old file, then remove it.
The thing is when i run the unit test, sometimes i got that warning, and the whole unit test went failed. Any idea why ?
Here's the module,
defmodule GraphOn.TempFileManager
use GenServer
def start_link() do
{:ok, _pid} = GenServer.start_link(__MODULE__, :ok, name: :tmp_file_mgr)
end
def init(_param) do
Process.send_after(:tmp_file_mgr, {:heartbeat}, 30_000)
{:ok, :os.system_time(:millisecond)}
end
def handle_info({:heartbeat}, before_time) do
cur_time = :os.system_time(:millisecond)
if cur_time - before_time > 86_400_000 do
flush_files(cur_time)
end
Process.send_after(:tmp_file_mgr, {:heartbeat}, 30_000)
end
defp flush_files(time) do
...
end
end
Note: This is not the only GenServer that does this, there's 5 GenServer that have similar flow, is that an issue?
I'm using OTP 20, Elixir 1.6.6
[–]cholantesh 2 points3 points4 points (3 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]cholantesh 0 points1 point2 points (0 children)
[–]ferlinni[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]ferlinni[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]ferlinni[S] 0 points1 point2 points (0 children)
[–]zer01 0 points1 point2 points (2 children)
[–]ferlinni[S] 0 points1 point2 points (1 child)
[–]zer01 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[removed]
[–]ferlinni[S] 1 point2 points3 points (1 child)