jaydoane commented on a change in pull request #3588:
URL: https://github.com/apache/couchdb/pull/3588#discussion_r642682755



##########
File path: src/aegis/src/aegis_server.erl
##########
@@ -286,8 +278,10 @@ is_key_fresh(UUID) ->
     Now = fabric2_util:now(sec),
 
     case ets:lookup(?KEY_CHECK, UUID) of
-        [{UUID, ExpiresAt}] when ExpiresAt >= Now -> true;
-        _ -> false
+        [{UUID, ExpiresAt}] when ExpiresAt - ?KEY_EARLY_EXPIRE_SEC > Now ->

Review comment:
       Yeah, I think something like
   ```erlang
       MatchConditions = [{'=<', '$1', fabric2_util:now(sec) - 
?KEY_EXPIRE_GRACE_SEC}],
   
   ```
   would also work, and is likely better for the reasons you mention.
   
   > you are not really refreshing a key, but expiring it ahead of the 
configured period and a client will just experience a latency bump earlier
   
   By returning false from `is_key_fresh`, it effectively forces a refresh, but 
yes, it sneakily shortens `CACHE_MAX_AGE_SEC` by a few seconds. Seems like just 
adding a grace period where the cache is still honored is maybe more intuitive.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to