rabbah commented on a change in pull request #2832: Do not cache invalidate 
when adding a DB attachment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2832#discussion_r154920536
 
 

 ##########
 File path: 
common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala
 ##########
 @@ -166,24 +166,29 @@ trait DocumentFactory[W] extends 
MultipleReadersSingleWriterCache[W, DocInfo] {
 
   def attach[Wsuper >: W](
     db: ArtifactStore[Wsuper],
-    doc: DocInfo,
+    doc: W,
+    docInfo: DocInfo,
     attachmentName: String,
     contentType: ContentType,
     bytes: InputStream)(implicit transid: TransactionId, notifier: 
Option[CacheChangeNotification]): Future[DocInfo] = {
 
     Try {
       require(db != null, "db undefined")
       require(doc != null, "doc undefined")
+      require(docInfo != null, "docInfo undefined")
     } map { _ =>
       implicit val logger = db.logging
       implicit val ec = db.executionContext
 
-      val key = CacheKey(doc.id.asDocInfo)
-      // invalidate the key because attachments update the revision;
-      // do not cache the new attachment (controller does not need it)
-      cacheInvalidate(key, {
-        val src = StreamConverters.fromInputStream(() => bytes)
-        db.attach(doc, attachmentName, contentType, src)
+      val key = CacheKey(doc)
 
 Review comment:
   The bound is now added to the trait. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to