fix timer

This commit is contained in:
Feng Lee 2015-10-10 11:53:31 +08:00
parent a2bbceff3c
commit d63f043566
1 changed files with 6 additions and 2 deletions

View File

@ -149,10 +149,14 @@ dispatch(Topic, CPid) when is_binary(Topic) ->
init([]) ->
StatsFun = emqttd_stats:statsfun('retained/count', 'retained/max'),
%% One second
{ok, StatsTimer} = timer:send_interval(1000, stats),
%% Five minutes
{ok, ExpireTimer} = timer:send_interval(300 * 1000, expire),
{ok, #state{stats_fun = StatsFun,
expired_after = env(expired_after),
stats_timer = timer:send_interval(1000, stats),
expire_timer = timer:send_interval(300 * 1000, expire)}}.
stats_timer = StatsTimer,
expire_timer = ExpireTimer}}.
handle_call(_Request, _From, State) ->
{reply, ok, State}.