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_r154920288
##########
File path:
common/scala/src/main/scala/whisk/core/database/DocumentFactory.scala
##########
@@ -149,15 +108,12 @@ trait DocumentFactory[W] extends
MultipleReadersSingleWriterCache[W, DocInfo] {
implicit val ec = db.executionContext
val key = CacheKey(doc)
+ val docInfo = doc.docinfo
- cacheUpdate(doc, key, db.put(doc) map { docinfo =>
- doc match {
- // if doc has a revision id, update it with new version
- case w: DocumentRevisionProvider => w.revision[W](docinfo.rev)
- }
- docinfo
+ cacheUpdate(doc, key, db.put(doc) map { newDocInfo =>
+ doc.revision[W](newDocInfo.rev)
Review comment:
I know I used the copy but thinking if instead we should have a .revision on
docinfo, or take the new doc info from the revised doc on line 114 to avoid an
unnecessary copy.
----------------------------------------------------------------
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