Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer monotonic time to measure durations (backport #11389) #11396

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading