markusthoemmes commented on a change in pull request #2584: SPI for Loadbalancer
URL: 
https://github.com/apache/incubator-openwhisk/pull/2584#discussion_r131842341
 
 

 ##########
 File path: 
common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
 ##########
 @@ -36,10 +38,17 @@ class CouchDbStoreProvider extends ArtifactStoreProvider {
         require(config.dbProvider == "Cloudant" || config.dbProvider == 
"CouchDB", "Unsupported db.provider: " + config.dbProvider)
         assume(Set(config.dbProtocol, config.dbHost, config.dbPort, 
config.dbUsername, config.dbPassword, name(config)).forall(_.nonEmpty), "At 
least one expected property is missing")
 
-        new CouchDbRestStore[D](config.dbProtocol, config.dbHost, 
config.dbPort.toInt, config.dbUsername, config.dbPassword, name(config))
+        val storeName = name(config)
+        stores.get(storeName) match {
 
 Review comment:
   There's `getOrElseUpdate` on scala's maps. You can use it like this:
   
   ```scala
   storeName.getOrElseUpdate(storeName, new 
CouchDbRestStore[D](config.dbProtocol, config.dbHost, config.dbPort.toInt, 
config.dbUsername, config.dbPassword, storeName))
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to