Skip to content

Commit 57433a1

Browse files
Calculate heartbeat writer interval in ms
Seconds and integer division provided lower-than-expected precision which matters a great deal with low values.
1 parent 360a604 commit 57433a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

projects/client/RabbitMQ.Client/src/client/impl/Connection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public ushort Heartbeat
235235
m_heartbeat = value;
236236
// timers fire at half the interval to avoid race
237237
// conditions
238-
m_heartbeatTimeSpan = TimeSpan.FromSeconds(value / 2);
238+
m_heartbeatTimeSpan = TimeSpan.FromMilliseconds((value * 1000) / 2.0);
239239
m_frameHandler.Timeout = (value * 1000) / 2;
240240
}
241241
}

0 commit comments

Comments
 (0)