summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kuryloski <kuryloskip@vmware.com>2021-12-10 13:17:31 +0100
committerPhilip Kuryloski <kuryloskip@vmware.com>2021-12-10 13:17:31 +0100
commite5eca1c5a47755758bb6ace6cfeed50e1a5d0e2b (patch)
treeaa861a6eafcd29c7a38f3555403c47f1ba3839c4
parentcf76b479300b767b8ea450293d096cbf729ed734 (diff)
downloadrabbitmq-server-git-pjk25/maybe-oldest_entry_timestamp.tar.gz
Return `none` as the oldest message timestamp for empty queuespjk25/maybe-oldest_entry_timestamp
instead of the current time
-rw-r--r--deps/rabbit/src/rabbit_fifo.erl11
1 files changed, 4 insertions, 7 deletions
diff --git a/deps/rabbit/src/rabbit_fifo.erl b/deps/rabbit/src/rabbit_fifo.erl
index e7efb21f61..84520548d3 100644
--- a/deps/rabbit/src/rabbit_fifo.erl
+++ b/deps/rabbit/src/rabbit_fifo.erl
@@ -807,17 +807,14 @@ handle_aux(_RaState, cast, eol, #aux{name = Name} = Aux, Log, _) ->
{no_reply, Aux, Log};
handle_aux(_RaState, {call, _From}, oldest_entry_timestamp, Aux,
Log, #?MODULE{ra_indexes = Indexes}) ->
- Ts = case rabbit_fifo_index:smallest(Indexes) of
- %% if there are no entries, we return current timestamp
- %% so that any previously obtained entries are considered older than this
+ case rabbit_fifo_index:smallest(Indexes) of
undefined ->
- erlang:system_time(millisecond);
+ {reply, {ok, none}, Aux, Log};
Idx when is_integer(Idx) ->
{{_, _, {_, Meta, _, _}}, _Log1} = ra_log:fetch(Idx, Log),
#{ts := Timestamp} = Meta,
- Timestamp
- end,
- {reply, {ok, Ts}, Aux, Log};
+ {reply, {ok, Timestamp}, Aux, Log}
+ end;
handle_aux(_RaState, {call, _From}, {peek, Pos}, Aux0,
Log0, MacState) ->
case rabbit_fifo:query_peek(Pos, MacState) of