File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,14 @@ confirm() ->
6565 suspend_heartbeat_messages (LeaderA ),
6666
6767 % % sleep longer than the HB timeout interval to force re-connection;
68- % % and give it time to restart the RT connection. Wait an extra 2 seconds.
69- timer :sleep (timer :seconds (? HB_TIMEOUT ) + 2000 ),
68+ % % and give it time to restart the RT connection.
69+ % % Since it's possible we may disable heartbeats right after a heartbeat has been fired,
70+ % % it can take up to 2*?HB_TIMEOUT seconds to detect a missed heartbeat. The extra second
71+ % % is to avoid rare race conditions due to the timeouts lining up exactly. Not the prettiest
72+ % % solution, but it failed so rarely at 2*HB_TIMEOUT, that this should be good enough
73+ % % in practice, and it beats having to write a bunch of fancy intercepts to verify that
74+ % % the timeout has been hit internally.
75+ timer :sleep (timer :seconds (? HB_TIMEOUT * 2 ) + 1000 ),
7076
7177 % % Verify that RT connection has restarted by noting that it's Pid has changed
7278 RTConnPid2 = get_rt_conn_pid (LeaderA ),
You can’t perform that action at this time.
0 commit comments