You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/04/02 16:01:45 UTC
[incubator-openwhisk] branch master updated: Only join cluster if
seed nodes are provided. (#3422)
This is an automated email from the ASF dual-hosted git repository.
dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new f2a8d69 Only join cluster if seed nodes are provided. (#3422)
f2a8d69 is described below
commit f2a8d69aea6db1ec4d7b8b5c45912a37e098264e
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Mon Apr 2 18:01:43 2018 +0200
Only join cluster if seed nodes are provided. (#3422)
---
.../ShardingContainerPoolBalancer.scala | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
index 1f5f398..f6ce75d 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
@@ -57,12 +57,16 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance: Ins
private implicit val executionContext: ExecutionContext = actorSystem.dispatcher
/** Build a cluster of all loadbalancers */
- val seedNodesProvider = new StaticSeedNodesProvider(config.controllerSeedNodes, actorSystem.name)
- val cluster = Cluster(actorSystem)
- cluster.joinSeedNodes(seedNodesProvider.getSeedNodes())
-
- /** Used to manage an action for testing invoker health */
- private val entityStore = WhiskEntityStore.datastore()
+ private val seedNodesProvider = new StaticSeedNodesProvider(config.controllerSeedNodes, actorSystem.name)
+ private val seedNodes = seedNodesProvider.getSeedNodes()
+
+ private val cluster: Option[Cluster] = if (seedNodes.nonEmpty) {
+ val cluster = Cluster(actorSystem)
+ cluster.joinSeedNodes(seedNodes)
+ Some(cluster)
+ } else {
+ None
+ }
/** State related to invocations and throttling */
private val activations = TrieMap[ActivationId, ActivationEntry]()
@@ -84,7 +88,7 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance: Ins
*/
private val monitor = actorSystem.actorOf(Props(new Actor {
override def preStart(): Unit = {
- cluster.subscribe(self, classOf[MemberEvent], classOf[ReachabilityEvent])
+ cluster.foreach(_.subscribe(self, classOf[MemberEvent], classOf[ReachabilityEvent]))
}
// all members of the cluster that are available
@@ -204,7 +208,7 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance: Ins
start,
s"posted to ${status.topic()}[${status.partition()}][${status.offset()}]",
logLevel = InfoLevel)
- case Failure(e) => transid.failed(this, start, s"error on posting to topic $topic")
+ case Failure(_) => transid.failed(this, start, s"error on posting to topic $topic")
}
}
@@ -250,7 +254,7 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance: Ins
val aid = response.fold(l => l, r => r.activationId)
// treat left as success (as it is the result of a message exceeding the bus limit)
- val isSuccess = response.fold(l => true, r => !r.response.isWhiskError)
+ val isSuccess = response.fold(_ => true, r => !r.response.isWhiskError)
activations.remove(aid) match {
case Some(entry) =>
--
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.