From 0dcf0854a8068b1de9000106ecca6e1d756b11e1 Mon Sep 17 00:00:00 2001 From: Kevin Lynx Date: Wed, 3 Jul 2013 20:08:33 +0800 Subject: [PATCH] fix http cache bug --- src/http_front/http_cache.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/http_front/http_cache.erl b/src/http_front/http_cache.erl index ca40088..6e284ba 100644 --- a/src/http_front/http_cache.erl +++ b/src/http_front/http_cache.erl @@ -68,8 +68,9 @@ handle_info(timeout, State) -> spawn_update(top), {noreply, State}; -handle_info({enter_cache, Type, Val}, State) -> +handle_info({enter_cache, Type, Time, Ret}, State) -> #state{cache = Cache} = State, + Val = {Time, Ret}, NewCache = gb_trees:enter(Type, Val, Cache), {noreply, State#state{cache = NewCache}}; @@ -136,7 +137,7 @@ async_update(Type, From) -> Start = now(), io:format("async update cache ~p start~n", [Type]), Ret = do_update(Type), - From ! {enter_cache, Type, Ret}, + From ! {enter_cache, Type, now(), Ret}, io:format("async update cache ~p done used ~p ms~n", [Type, timer:now_diff(now(), Start) div 1000]).