diff options
author | Damien F. Katz <damien@apache.org> | 2008-04-07 19:51:17 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-04-07 19:51:17 +0000 |
commit | 9c27e4d7db0e2e6a1b458f8545f584fcfaea4ef2 (patch) | |
tree | 94cf96af696ab3042d2afd1f4e4e7d83a98b1568 /src/couchdb/couch_query_servers.erl | |
parent | 4708e70c612a797b5d15774149ed589996d0c2e3 (diff) |
Compaction. Works, but still needs queueing and better handling for long reads/writes overlapping the compaction switchover.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@645661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_query_servers.erl')
-rw-r--r-- | src/couchdb/couch_query_servers.erl | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl index 19cba9bd..33962705 100644 --- a/src/couchdb/couch_query_servers.erl +++ b/src/couchdb/couch_query_servers.erl @@ -36,8 +36,6 @@ readline(Port) -> readline(Port, []). readline(Port, Acc) -> - Timer = erlang:send_after(timeout(), self(), timeout), - Result = receive {Port, {data, {noeol, Data}}} -> readline(Port, [Data|Acc]); @@ -45,20 +43,11 @@ readline(Port, Acc) -> lists:flatten(lists:reverse(Acc, Data)); {Port, Err} -> catch port_close(Port), - erlang:cancel_timer(Timer), - throw({map_process_error, Err}); - timeout -> + throw({map_process_error, Err}) + after timeout() -> catch port_close(Port), throw({map_process_error, "map function timed out"}) - end, - case erlang:cancel_timer(Timer) of - false -> - % message already sent. clear it - receive timeout -> ok end; - _ -> - ok - end, - Result. + end. read_json(Port) -> case cjson:decode(readline(Port)) of @@ -108,8 +97,7 @@ start_doc_map(Lang, Functions) -> map_docs({_Lang, Port}, Docs) -> % send the documents - Results = - lists:map( + Results = lists:map( fun(Doc) -> Json = couch_doc:to_json_obj(Doc, []), case prompt(Port, {"map_doc", Json}) of |