We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dbb8ce3 commit 2cad173Copy full SHA for 2cad173
lib/mongo/server/round_trip_time_calculator.rb
@@ -35,6 +35,7 @@ def initialize
35
@last_round_trip_time = nil
36
@average_round_trip_time = nil
37
@minimum_round_trip_time = 0
38
+ @lock = Mutex.new
39
@rtts = []
40
end
41
@@ -60,8 +61,10 @@ def measure
60
61
# but we must not update the round trip time recorded in the server.
62
unless exc
63
@last_round_trip_time = last_rtt
- update_average_round_trip_time
64
- update_minimum_round_trip_time
+ @lock.synchronize do
65
+ update_average_round_trip_time
66
+ update_minimum_round_trip_time
67
+ end
68
69
70
if exc
0 commit comments