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 3bddfb94b0243a051e548a912ce04c7885a366f5 Author: Jay Doane <jaydo...@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}.