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

    https://github.com/apache/couchdb-couch/pull/236#discussion_r105822026
  
    --- Diff: src/couch_db_updater.erl ---
    @@ -1454,3 +1468,28 @@ 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
    +
    +schedule_timeout() ->
    +    case get(idle_timer_ref) of
    +        TimerRef when is_reference(TimerRef) ->
    +            erlang:cancel_timer(TimerRef);
    +        undefined  ->
    +            ok
    +    end,
    +    put(idle_timer_ref, erlang:send_after(idle_limit(), self(), timeout)).
    +
    +update_idle_limit_from_config() ->
    +    Default = integer_to_list(?IDLE_LIMIT_DEFAULT),
    +    IdleLimit = case config:get("couchdb", "idle_check_timeout", Default) 
of
    +        "infinity" ->
    +            infinity;
    --- End diff --
    
    Using `hibernate` here would force a hibernation but then it would force it 
more often (on every callback) than before. We did that only after update_docs. 
And the rest was effectively `infinity`.
    
    I'll try to restore the old behavior so on infinity idle_check_timeout we 
hibernate after update_docs only. So we have a way to restore that old mode if 
need be in production.
    
    Also one downside with this simplistic approach with config is that setting 
infinity means not having timeout fire so then config value will not be 
updated. This might involve a change listener or sticking 
update_idle_limit_from_config() call in other places that might be called 
periodically. Is it worth doing that?


---
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