Fix match_spec's in couch_proc_manager When using a list or tuple in a match_spec condition clause we have to wrap them in a tuple or it throws a badarg error.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/f77e6946 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/f77e6946 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/f77e6946 Branch: refs/heads/windsor-merge-209 Commit: f77e6946afdd547c25c4cfbcac3d794b663174bd Parents: 2f3a1fd Author: Paul J. Davis <[email protected]> Authored: Fri Jun 14 14:51:33 2013 -0500 Committer: Robert Newson <[email protected]> Committed: Tue Aug 5 16:10:36 2014 +0100 ---------------------------------------------------------------------- src/couch_proc_manager.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f77e6946/src/couch_proc_manager.erl ---------------------------------------------------------------------- diff --git a/src/couch_proc_manager.erl b/src/couch_proc_manager.erl index 252de2c..6a64fa7 100644 --- a/src/couch_proc_manager.erl +++ b/src/couch_proc_manager.erl @@ -92,7 +92,7 @@ handle_call(get_proc_count, _From, State) -> handle_call(get_stale_proc_count, _From, State) -> #state{tab = Tab, threshold_ts = T0} = State, - MatchSpec = [{#proc_int{t0='$1', _='_'}, [{'<', '$1', T0}], [true]}], + MatchSpec = [{#proc_int{t0='$1', _='_'}, [{'<', '$1', {T0}}], [true]}], {reply, ets:select_count(Tab, MatchSpec), State}; handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, From, State) -> @@ -147,7 +147,7 @@ handle_call(bump_threshold_ts, _From, #state{tab = Tab} = State) -> handle_call(terminate_stale_procs, _From, State) -> #state{tab = Tab, threshold_ts = T0} = State, MatchHead = #proc_int{pid = '$1', t0 = '$2', _ = '_'}, - MatchSpec = [{MatchHead, [{'<', '$2', T0}], ['$1']}], + MatchSpec = [{MatchHead, [{'<', '$2', {T0}}], ['$1']}], lists:foreach(fun(P) -> remove_proc(Tab,P) end, ets:select(Tab, MatchSpec)), {reply, ok, State};
