From ab11dc0ea82adcea7697a7aa6e330e25cfa8de24 Mon Sep 17 00:00:00 2001 From: Christian Bickel Date: Tue, 6 Nov 2018 13:33:32 +0100 Subject: [PATCH] Always return activation without log on blocking invoke. (#4100) If a user invokes a blocking action today, the invoker executes the activation and sends back the result to the controller, which passes it back to the client. If it is not possible to pass the result back to the controller, the controller will try to get the result from the database. And here's the problem. If the controller receives the result of the activation from the invoker, there are no logs included. If it polls it from the database, the logs are included. This should be unified to never return logs. --- .../scala/whisk/core/controller/actions/PrimitiveActions.scala | 2 +- .../scala/whisk/core/controller/test/ActionsApiTests.scala | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala b/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala index b924d931da6..d16bafa8be8 100644 --- a/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala +++ b/core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala @@ -631,7 +631,7 @@ protected[actions] trait PrimitiveActions { LoggingMarkers.CONTROLLER_ACTIVATION_BLOCKING_DATABASE_RETRIEVAL, s"retrieved activation for blocking invocation via DB polling", logLevel = InfoLevel) - result.trySuccess(Right(activation)) + result.trySuccess(Right(activation.withoutLogs)) case Failure(_: NoDocumentException) => pollActivation(docid, context, result, wait, retries + 1, maxRetries) case Failure(t: Throwable) => result.tryFailure(t) } diff --git a/tests/src/test/scala/whisk/core/controller/test/ActionsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/ActionsApiTests.scala index fe4d2171e24..31a996a2ed0 100644 --- a/tests/src/test/scala/whisk/core/controller/test/ActionsApiTests.scala +++ b/tests/src/test/scala/whisk/core/controller/test/ActionsApiTests.scala @@ -1271,7 +1271,8 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi { activationIdFactory.make(), start = Instant.now, end = Instant.now, - response = ActivationResponse.success(Some(JsObject("test" -> "yes".toJson)))) + response = ActivationResponse.success(Some(JsObject("test" -> "yes".toJson))), + logs = ActivationLogs(Vector("first line", "second line"))) put(entityStore, action) // storing the activation in the db will allow the db polling to retrieve it // the test harness makes sure the activation id observed by the test matches