scripts/autoscale.js
function isMasterExpired(instance) {
        const masterStatus = instance.masterStatus || {};
        let isExpired = false;
        let disconnectedMs;

        if (masterStatus.status !== CloudProvider.STATUS_OK) {
            disconnectedMs = new Date() - new Date(masterStatus.lastStatusChange);
            logger.silly('master has been disconnected for', disconnectedMs.toString(), 'ms');
            if (disconnectedMs > MAX_DISCONNECTED_MS) {
                logger.info('master has been disconnected for too long (', disconnectedMs.toString(), 'ms )');
                isExpired = true;
            }
        }
        return isExpired;
    }
function isMasterExpired(instance) {
        const masterStatus = instance.masterStatus || {};
        let isExpired = false;
        let disconnectedMs;

        if (masterStatus.status !== CloudProvider.STATUS_OK) {
            disconnectedMs = new Date() - new Date(masterStatus.lastStatusChange);
            logger.silly('master has been disconnected for', disconnectedMs.toString(), 'ms');
            if (disconnectedMs > MAX_DISCONNECTED_MS) {
                logger.info('master has been disconnected for too long (', disconnectedMs.toString(), 'ms )');
                isExpired = true;
            }
        }
        return isExpired;
    }
/*
Determines if the master status has been bad for more than a certain
amount of time.

@param {Object} instance - instance as returned by getInstances

@returns {Boolean} Whether or not the master status has been bad for too long