style95 commented on a change in pull request #5205:
URL: https://github.com/apache/openwhisk/pull/5205#discussion_r833860489



##########
File path: 
core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala
##########
@@ -293,18 +292,38 @@ class InvokerReactive(
   }
 
   private val healthProducer = msgProvider.getProducer(config)
-  Scheduler.scheduleWaitAtMost(1.seconds)(() => {
-    healthProducer.send(s"${Invoker.topicPrefix}health", 
PingMessage(instance)).andThen {
-      case Failure(t) => logging.error(this, s"failed to ping the controller: 
$t")
-    }
-  })
+
+  def getHealthScheduler: ActorRef =
+    Scheduler.scheduleWaitAtMost(1.seconds)(() => {
+      healthProducer.send(s"${Invoker.topicPrefix}health", 
PingMessage(instance)).andThen {
+        case Failure(t) => logging.error(this, s"failed to ping the 
controller: $t")
+      }
+    })
+
+  var healthScheduler: Option[ActorRef] = Some(getHealthScheduler)
 
   override def enable(): Route = {
+    if (healthScheduler.isEmpty) {
+      healthScheduler = Some(getHealthScheduler)
+      complete(s"${instance.toString} is now enabled.")
+    } else {
+      complete(s"${instance.toString} is already enabled.")
+    }
     complete("not supported")
   }
 
   override def disable(): Route = {
-    complete("not supported")
+    if (healthScheduler.nonEmpty) {
+      actorSystem.stop(healthScheduler.get)
+      healthScheduler = None

Review comment:
       Since the new scheduler relies on ETCD for health, the logic resides in 
the old scheduler.
   
   I looked into the downstream code and realize that we just did a workaround 
to minimize the change by using an instance ID that is less than 0.
   I think this would not be an official way but just a workaround.
   
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to