From c4b901766c9fbe006890597e7c8ad5dfab83f96f Mon Sep 17 00:00:00 2001 From: Namdak Tonpa Date: Thu, 7 Mar 2019 02:55:05 +0200 Subject: [PATCH] fix timer for #pi --- src/n2o.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/n2o.erl b/src/n2o.erl index 9ce0024b..77b68846 100644 --- a/src/n2o.erl +++ b/src/n2o.erl @@ -123,17 +123,17 @@ error_page(Class,Error) -> % TIMER -proc(init,#handler{}=Async) -> +proc(init,#pi{}=Async) -> n2o:info(?MODULE,"Proc Init: ~p\r~n",[init]), Timer = timer_restart(ping()), - {ok,Async#handler{state=Timer}}; + {ok,Async#pi{state=Timer}}; -proc({timer,ping},#handler{state=Timer}=Async) -> +proc({timer,ping},#pi{state=Timer}=Async) -> erlang:cancel_timer(Timer), n2o:info(?MODULE,"n2o Timer: ~p\r~n",[ping]), n2o:invalidate_cache(caching), (n2o_session:storage()):invalidate_sessions(), - {reply,ok,Async#handler{state=timer_restart(ping())}}. + {reply,ok,Async#pi{state=timer_restart(ping())}}. invalidate_cache(Table) -> ets:foldl(fun(X,_) -> n2o:cache(Table,element(1,X)) end, 0, Table). timer_restart(Diff) -> {X,Y,Z} = Diff, erlang:send_after(1000*(Z+60*Y+60*60*X),self(),{timer,ping}).