From b25b5b1966960a580293a0bdefcf8d290efe9b4d Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 21 Oct 2010 21:48:39 -0400 Subject: use erlang:send_after/3 instead of timer version http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id52228 --- apps/couch/src/couch_file.erl | 4 ++-- apps/mem3/src/mem3_cache.erl | 2 +- apps/mem3/src/mem3_nodes.erl | 2 +- apps/rexi/src/rexi_utils.erl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/couch/src/couch_file.erl b/apps/couch/src/couch_file.erl index 2d539f64..b3d91bb4 100644 --- a/apps/couch/src/couch_file.erl +++ b/apps/couch/src/couch_file.erl @@ -237,7 +237,7 @@ init_status_error(ReturnPid, Ref, Error) -> init({Filepath, Options, ReturnPid, Ref}) -> process_flag(trap_exit, true), - timer:send_after(60000, maybe_close), + erlang:send_after(60000, self(), maybe_close), case lists:member(create, Options) of true -> filelib:ensure_dir(Filepath), @@ -489,7 +489,7 @@ handle_info(maybe_close, Fd) -> [?MODULE, self()]), {stop, normal, Fd}; _Else -> - timer:send_after(10000, maybe_close), + erlang:send_after(10000, self(), maybe_close), {noreply, Fd} end; handle_info({'EXIT', _, normal}, Fd) -> diff --git a/apps/mem3/src/mem3_cache.erl b/apps/mem3/src/mem3_cache.erl index 419e0d7c..6614c29e 100644 --- a/apps/mem3/src/mem3_cache.erl +++ b/apps/mem3/src/mem3_cache.erl @@ -45,7 +45,7 @@ handle_info({'DOWN', _, _, Pid, {badarg, [{ets,delete,[partitions,_]}|_]}}, handle_info({'DOWN', _, _, Pid, Reason}, #state{changes_pid=Pid} = State) -> ?LOG_INFO("~p changes listener died ~p", [?MODULE, Reason]), Seq = case Reason of {seq, EndSeq} -> EndSeq; _ -> 0 end, - timer:send_after(5000, {start_listener, Seq}), + erlang:send_after(5000, self(), {start_listener, Seq}), {noreply, State}; handle_info({start_listener, Seq}, State) -> {NewPid, _} = spawn_monitor(fun() -> listen_for_changes(Seq) end), diff --git a/apps/mem3/src/mem3_nodes.erl b/apps/mem3/src/mem3_nodes.erl index c8528cb6..f9320598 100644 --- a/apps/mem3/src/mem3_nodes.erl +++ b/apps/mem3/src/mem3_nodes.erl @@ -53,7 +53,7 @@ handle_info({'DOWN', _, _, Pid, Reason}, #state{changes_pid=Pid} = State) -> ?LOG_INFO("~p changes listener died ~p", [?MODULE, Reason]), StartSeq = State#state.update_seq, Seq = case Reason of {seq, EndSeq} -> EndSeq; _ -> StartSeq end, - timer:send_after(5000, start_listener), + erlang:send_after(5000, self(), start_listener), {noreply, State#state{update_seq = Seq}}; handle_info(start_listener, #state{update_seq = Seq} = State) -> {NewPid, _} = spawn_monitor(fun() -> listen_for_changes(Seq) end), diff --git a/apps/rexi/src/rexi_utils.erl b/apps/rexi/src/rexi_utils.erl index 79183951..1e8820e1 100644 --- a/apps/rexi/src/rexi_utils.erl +++ b/apps/rexi/src/rexi_utils.erl @@ -9,7 +9,7 @@ recv(Refs, Keypos, Fun, Acc0, infinity, PerMsgTO) -> process_mailbox(Refs, Keypos, Fun, Acc0, nil, PerMsgTO); recv(Refs, Keypos, Fun, Acc0, GlobalTimeout, PerMsgTO) -> TimeoutRef = erlang:make_ref(), - {ok, TRef} = timer:send_after(GlobalTimeout, {timeout, TimeoutRef}), + {ok, TRef} = erlang:send_after(GlobalTimeout, self(), {timeout, TimeoutRef}), try process_mailbox(Refs, Keypos, Fun, Acc0, TimeoutRef, PerMsgTO) after -- cgit v1.2.3