in management-cluster-bootstrap/src/main/scala/org/apache/pekko/management/cluster/bootstrap/internal/HttpContactPointBootstrap.scala [105:135]
private def resetProbingKeepFailingWithinDeadline(): Unit =
probingKeepFailingDeadline = settings.contactPoint.probingFailureTimeout.fromNow
override def preStart(): Unit =
self ! ProbeTick
override def receive = {
case ProbeTick =>
log.debug("Probing [{}] for seed nodes...", probeRequest.uri)
val reply = http.singleRequest(probeRequest, settings = connectionPoolWithoutRetries).flatMap(handleResponse)
val afterTimeout = after(settings.contactPoint.probingFailureTimeout, context.system.scheduler)(replyTimeout)
Future.firstCompletedOf(List(reply, afterTimeout)).pipeTo(self)
case Status.Failure(cause) =>
log.warning("Probing [{}] failed due to: {}", probeRequest.uri, cause.getMessage)
if (probingKeepFailingDeadline.isOverdue()) {
log.error("Overdue of probing-failure-timeout, stop probing, signaling that it's failed")
context.parent ! BootstrapCoordinator.Protocol.ProbingFailed(contactPoint, cause)
context.stop(self)
} else {
// keep probing, hoping the request will eventually succeed
scheduleNextContactPointProbing()
}
case response: SeedNodes =>
notifyParentAboutSeedNodes(response)
resetProbingKeepFailingWithinDeadline()
// we keep probing and looking if maybe a cluster does form after all
// (technically could be long polling or web-sockets, but that would need reconnect logic, so this is simpler)
scheduleNextContactPointProbing()
}