Github user nickva commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/236#discussion_r105918717
  
    --- Diff: src/couch_db_updater.erl ---
    @@ -1454,3 +1468,44 @@ default_security_object(_DbName) ->
             "everyone" ->
                 []
         end.
    +
    +% These functions rely on using the process dictionary. This is usually 
frowned
    +% upon howver in this case it is done to avoid changing to a different 
server state
    +% record. Once PSE (Pluggable Storage Engine) code lands this should be 
moved to the
    +% #db{} record.
    +
    +schedule_timeout() ->
    +    case get(idle_timer_ref) of
    +        TimerRef when is_reference(TimerRef) ->
    +            erlang:cancel_timer(TimerRef);
    +        undefined  ->
    +            ok
    +    end,
    +    case idle_limit() of
    +        infinity ->
    +            ok;
    +        Timeout when is_integer(Timeout) ->
    +            TRef = erlang:send_after(Timeout, self(), timeout),
    --- End diff --
    
    It was to preserve hibernate semantics. If we didn't have hibernate there 
for update_docs could have just been returning a timeout on gen_server replies. 
But because the reply is {reply, Result, State, Timeout|hibernate) we could not 
both hibernate and trigger a timeout. 
    
    The timeouts in the gen_server replies are used to detect idleness.
    
    I wonder if we just want to do a gc call instead of a hibernate and get rid 
of the extra timer management.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to