MXS-1446: Add heartbeat conversion macros

The macros make the conversion from heartbeats to seconds more convenient
and consistent.
This commit is contained in:
Markus Mäkelä
2017-09-27 11:15:22 +03:00
parent 667440fbef
commit 0d6c06f33d
5 changed files with 16 additions and 7 deletions

View File

@ -1784,8 +1784,7 @@ void mon_process_state_changes(MXS_MONITOR *monitor, const char *script, uint64_
ptr->new_event && // Event has not yet been processed
monitor->last_master_down > monitor->last_master_up) // Latest relevant event
{
// Scale the timeout to heartbeat resolution which is 1/10th of a second
int64_t timeout = (int64_t)monitor->failover_timeout * 10;
int64_t timeout = SEC_TO_HB(monitor->failover_timeout);
int64_t t = hkheartbeat - ptr->server->triggered_at;
if (t > timeout)