Skip to content

Commit

Permalink
Merge pull request #11396 from rabbitmq/mergify/bp/v3.13.x/pr-11389
Browse files Browse the repository at this point in the history
Prefer monotonic time to measure durations (backport #11389)
  • Loading branch information
michaelklishin authored Jun 6, 2024
2 parents 9a1770e + 9c81f49 commit 589ace5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deps/rabbit/src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
delivery_tag,
%% consumer tag
tag,
delivered_at,
delivered_at :: integer(),
%% queue name
queue,
%% message ID used by queue and message store implementations
Expand Down Expand Up @@ -1985,10 +1985,10 @@ record_sent(Type, QueueType, Tag, AckRequired,
false ->
ok
end,
DeliveredAt = os:system_time(millisecond),
rabbit_trace:tap_out(Msg, ConnName, ChannelNum, Username, TraceState),
UAMQ1 = case AckRequired of
true ->
DeliveredAt = erlang:monotonic_time(millisecond),
?QUEUE:in(#pending_ack{delivery_tag = DeliveryTag,
tag = Tag,
delivered_at = DeliveredAt,
Expand Down Expand Up @@ -2778,7 +2778,7 @@ evaluate_consumer_timeout(State = #ch{unacked_message_q = UAMQ}) ->

evaluate_consumer_timeout1(PA = #pending_ack{delivered_at = Time},
State) ->
Now = os:system_time(millisecond),
Now = erlang:monotonic_time(millisecond),
case get_consumer_timeout(PA, State) of
Timeout when is_integer(Timeout)
andalso Time < Now - Timeout ->
Expand Down

0 comments on commit 589ace5

Please sign in to comment.