Reputation: 957
I have following code:
send_event_at({TsMsec,Msg}) ->
Now = os:system_time(micro_seconds),
NowMsec = erlang:convert_time_unit(Now,micro_seconds,milli_seconds),
DelayMsec = TsMsec - NowMsec,
if DelayMsec >= 0 ->
erlang:send_after(DelayMsec,self(),Msg);
true -> ignore
end.
Then in gen_fsm I handle this messages as:
handle_info({new_status,{Status,HrQtKey}},StateName,State) ->
.....
{next_state,StateName,State};
Code used to send messages with delays up to 48 hours. Most of the time everything is Ok.
But if my gen_fsm has a decent amount of incoming messages, new_status messages are delaying up to 15 minutes.
This bug is appeared not too often but it is really annoying.
And idea what could be the reasons and what would be the best way to fix it?
Upvotes: 0
Views: 392
Reputation: 14042
Some clues:
Upvotes: 2