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

 ##########
 File path: 
common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
 ##########
 @@ -36,10 +38,14 @@ 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.getOrElseUpdate(storeName, new 
CouchDbRestStore[D](config.dbProtocol, config.dbHost, config.dbPort.toInt, 
config.dbUsername, config.dbPassword, storeName,
+            ()=>stores.remove(storeName)))
+                .asInstanceOf[CouchDbRestStore[D]]
 
 Review comment:
   Formatting this in a bit more context would make sense imho:
   
   ```scala
   stores.getOrElseUpdate(storeName, 
       new CouchDbRestStore[D](config.dbProtocol, config.dbHost, 
config.dbPort.toInt, config.dbUsername, config.dbPassword, storeName, () => 
stores.remove(storeName))
   ).asInstanceOf[CouchDbRestStore[D]]
   ```
 
----------------------------------------------------------------
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