diff options
Diffstat (limited to 'src/couchdb/couch_rep_changes_feed.erl')
-rw-r--r-- | src/couchdb/couch_rep_changes_feed.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl index 67cfabe4..7c308800 100644 --- a/src/couchdb/couch_rep_changes_feed.erl +++ b/src/couchdb/couch_rep_changes_feed.erl @@ -40,7 +40,9 @@ start_link(Parent, Source, StartSeq, PostProps) -> gen_server:start_link(?MODULE, [Parent, Source, StartSeq, PostProps], []). next(Server) -> - gen_server:call(Server, next_changes, infinity). + try gen_server:call(Server, next_changes, 31000) + catch exit:{timeout, _Reason} -> throw(changes_timeout) + end. stop(Server) -> gen_server:call(Server, stop). @@ -83,8 +85,7 @@ init([_Parent, #http_db{}=Source, Since, PostProps] = Args) -> resource = "_changes", qs = QS, conn = Pid, - options = [{stream_to, {self(), once}}, {response_format, binary}, - {inactivity_timeout, 31000}], % miss 3 heartbeats, assume death + options = [{stream_to, {self(), once}}, {response_format, binary}], headers = Source#http_db.headers -- [{"Accept-Encoding", "gzip"}] }, {ibrowse_req_id, ReqId} = couch_rep_httpc:request(Req), @@ -202,6 +203,9 @@ handle_info({'EXIT', From, Reason}, #state{changes_loop=From} = State) -> ?LOG_ERROR("changes_loop died with reason ~p", [Reason]), {stop, changes_loop_died, State}; +handle_info({'EXIT', _From, normal}, State) -> + {noreply, State}; + handle_info(Msg, State) -> ?LOG_DEBUG("unexpected message at changes_feed ~p", [Msg]), {noreply, State}. |