bdoyle0182 commented on a change in pull request #5205:
URL: https://github.com/apache/openwhisk/pull/5205#discussion_r833857507
##########
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:
Is that on the old scheduler for your downstream or a part of the new
scheduler?
If on the old scheduler, I could do that as a follow up since it would
require a change to the message bus and logic in the controller to read
different health pings off the health topic. But think it's more of an
optimization since the controller should recognize it as offline within ten
seconds of disabling.
--
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]