You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2019/11/19 00:27:15 UTC

[couchdb] 03/06: Rename last_expiration to last_removal

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch expiring-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d4861f266f57f276f788cb9cddf5524f83e9d150
Author: Jay Doane <ja...@apache.org>
AuthorDate: Sun Nov 10 23:52:50 2019 -0800

    Rename last_expiration to last_removal
---
 .../src/couch_expiring_cache_server.erl                    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/couch_expiring_cache/src/couch_expiring_cache_server.erl b/src/couch_expiring_cache/src/couch_expiring_cache_server.erl
index f67e7be..82a90aa 100644
--- a/src/couch_expiring_cache/src/couch_expiring_cache_server.erl
+++ b/src/couch_expiring_cache/src/couch_expiring_cache_server.erl
@@ -42,7 +42,7 @@ init(_) ->
     {ok, #{
         timer_ref => Ref,
         lag => 0,
-        last_expiration => 0,
+        last_removal => 0,
         min_ts => 0}}.
 
 
@@ -58,15 +58,15 @@ handle_cast(Msg, St) ->
     {stop, {bad_cast, Msg}, St}.
 
 
-handle_info(remove_expired, St) ->
+handle_info(remove_expired, St = #{min_ts := MinTS0}) ->
     Now = erlang:system_time(second),
-    MinTS = remove_expired(Now),
+    MinTS = max(MinTS0, remove_expired(Now)),
     Ref = schedule_remove_expired(),
     {noreply, St#{
-        timer_ref => Ref,
-        lag => Now - MinTS,
-        last_expiration => Now,
-        min_ts => MinTS}};
+        timer_ref := Ref,
+        lag := Now - MinTS,
+        last_removal := Now,
+        min_ts := MinTS}};
 
 handle_info(Msg, St) ->
     {stop, {bad_info, Msg}, St}.