sven-lange-last commented on a change in pull request #2878: Streamingly read
user-logs.
URL:
https://github.com/apache/incubator-openwhisk/pull/2878#discussion_r152979617
##########
File path:
core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala
##########
@@ -370,24 +371,25 @@ class ContainerProxy(factory: (TransactionId, String,
ImageName, Boolean, ByteSi
.flatMap { activation =>
val start = tid.started(this, LoggingMarkers.INVOKER_COLLECT_LOGS)
collectLogs(tid, container, job.action)
- .map { logs =>
- tid.finished(this, start)
- activation.withLogs(logs)
- }
- .recover {
- case _ =>
+ .recoverWith {
+ case t =>
tid.failed(this, start)
- activation.withLogs(ActivationLogs(Vector(Messages.logFailure)))
+ val withLogs = t match {
+ case LogCollectingException(logs) => activation.withLogs(logs)
+ case _ =>
activation.withLogs(ActivationLogs(Vector(Messages.logFailure)))
+ }
+ storeActivation(tid, withLogs)
+
+ Future.failed(ActivationLogReadingError(withLogs))
+ }
Review comment:
It would be helpful to have a comment here that the `recoverWith` path with
always end up in a failed Future so that the following `flatMap` will be
skipped.
----------------------------------------------------------------
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