You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/11/25 01:47:23 UTC

[GitHub] rabbah commented on a change in pull request #2832: Do not cache invalidate when adding a DB attachment

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_r153035470
 
 

 ##########
 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 `key` for `doc: WhiskEntity` is `docInfo`, so you could create a `DocInfo` instance out of the key.
   alternatively, if `W` is bounded to `WhiskDocument` then you can get its `id.asDocInfo`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services