You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/11/12 21:15:05 UTC

[GitHub] [openwhisk] tysonnorris commented on a change in pull request #4698: Add healthcheck for Invoker -> Action Container

tysonnorris commented on a change in pull request #4698: Add healthcheck for Invoker -> Action Container 
URL: https://github.com/apache/openwhisk/pull/4698#discussion_r345448086
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
 ##########
 @@ -820,6 +907,98 @@ object ContainerProxy {
   }
 }
 
+object TCPPingClient {
+  def props(config: ContainerProxyHealthCheckConfig, remote: InetSocketAddress, replies: ActorRef) =
+    Props(new TCPPingClient(remote, replies, config))
+}
+
+class TCPPingClient(remote: InetSocketAddress, listener: ActorRef, config: ContainerProxyHealthCheckConfig)
+    extends Actor {
+  implicit val logging = new AkkaLogging(context.system.log)
+  import context.system
+  implicit val ec = context.system.dispatcher
+  implicit var healthPingTx = TransactionId.actionHealthPing
+
+  var scheduledPing: Option[Cancellable] = None
+  var failedCount = 0
+  var pingMarker: StartMarker = null
+  val tcp = IO(Tcp)
+  var resume: Option[Promise[Unit]] = None
+  val addressString = s"${remote.getHostString}:${remote.getPort}"
+  restartPing()
+
+  private def restartPing() = {
+    cancelPing() //just in case restart is called twice
+    scheduledPing = Some(
+      context.system.scheduler.schedule(config.checkPeriod, config.checkPeriod, self, HealthPingSend(false)))
 
 Review comment:
   I think waiting at least one checkPeriod before checking the first time is fine, since presumably it was just (immediately prior to this) being used, so we don't need the check till we have stopped using it for a bit. If this is important to be 0, or some other value besides checkPeriod, we could expose another config field to allow operators to specify the initial delay. WDYT?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services