async isPrimaryHealthy (primary) {
    const isHealthy = await this.isNodeHealthy(primary, true)

    if (!isHealthy) {
      const failedTimestamp = this.getEarliestFailedHealthCheckTimestamp(primary)

      if (failedTimestamp) {
        // Generate the date of the failed timestamp + max hours threshold
        let failedTimestampPlusThreshold = new Date(failedTimestamp)
        failedTimestampPlusThreshold.setSeconds(
          failedTimestamp.getSeconds() + this.maxNumberSecondsPrimaryRemainsUnhealthy
        )

        // Determine if the failed timestamp + max hours threshold surpasses our allowed time threshold
        const now = new Date()
        if (now >= failedTimestampPlusThreshold) { return false }
      } else {
        this.addHealthCheckTimestamp(primary)
      }
      return true
    }

    // If a primary ever becomes healthy again and was once marked as unhealthy, remove tracker
    this.removePrimaryFromUnhealthyPrimaryMap(primary)
    return true
  }
/**
   * Perform a simple health check to see if a primary is truly unhealthy. If the primary returns a
   * non-200 response, track the timestamp in the map. If the health check has failed for a primary over
   * `this.maxNumberSecondsPrimaryRemainsUnhealthy`, return as unhealthy. Else, keep track of the timestamp
   * of the visit if not already tracked.
   *
   * If the primary is healthy, reset the counter in the map and return as healthy.
   * @param {string} primary primary endpoint
   * @returns boolean of whether primary is healthy or not
   */
Perform a simple health check to see if a primary is truly unhealthy. If the primary returns a
non-200 response, track the timestamp in the map. If the health check has failed for a primary over
`this.maxNumberSecondsPrimaryRemainsUnhealthy`, return as unhealthy. Else, keep track of the timestamp
of the visit if not already tracked.

If the primary is healthy, reset the counter in the map and return as healthy.
@param {string} primary primary endpoint
@returns boolean of whether primary is healthy or not
Perform a simple health check to see if a primary is truly unhealthy . If the primary returns a non - 200 response track the timestamp in the map . If the health check has failed for a primary over ` this . maxNumberSecondsPrimaryRemainsUnhealthy ` return as unhealthy . Else keep track of the timestamp of the visit if not already tracked . If the primary is healthy reset the counter in the map and return as healthy . @param { string } primary primary endpoint @returns boolean of whether primary is healthy or not
async isPrimaryHealthy (primary) {
    const isHealthy = await this.isNodeHealthy(primary, true)
    if (!isHealthy) {
      const failedTimestamp = this.getEarliestFailedHealthCheckTimestamp(primary)
      if (failedTimestamp) {
        let failedTimestampPlusThreshold = new Date(failedTimestamp)
        failedTimestampPlusThreshold.setSeconds(
          failedTimestamp.getSeconds() + this.maxNumberSecondsPrimaryRemainsUnhealthy
        )
        const now = new Date()
        if (now >= failedTimestampPlusThreshold) { return false }
      } else {
        this.addHealthCheckTimestamp(primary)
      }
      return true
    }
    this.removePrimaryFromUnhealthyPrimaryMap(primary)
    return true
  }
async isPrimaryHealthy ( primary ) { const isHealthy = await this . isNodeHealthy ( primary , true ) if ( ! isHealthy ) { const failedTimestamp = this . getEarliestFailedHealthCheckTimestamp ( primary ) if ( failedTimestamp ) { let failedTimestampPlusThreshold = new Date ( failedTimestamp ) failedTimestampPlusThreshold . setSeconds ( failedTimestamp . getSeconds ( ) + this . maxNumberSecondsPrimaryRemainsUnhealthy ) const now = new Date ( ) if ( now >= failedTimestampPlusThreshold ) { return false } } else { this . addHealthCheckTimestamp ( primary ) } return true } this . removePrimaryFromUnhealthyPrimaryMap ( primary ) return true }
Perform a simple health check to see if a primary is truly unhealthy.
Perform a simple health check to see if a primary is truly unhealthy .
// Generate the date of the failed timestamp + max hours threshold // Determine if the failed timestamp + max hours threshold surpasses our allowed time threshold // If a primary ever becomes healthy again and was once marked as unhealthy, remove tracker