@@ -34,9 +34,11 @@ case class UserContext(user: Identity, request: HttpRequest = HttpRequest())
34
34
trait ActivationStore {
35
35
/* DEPRECATED: disableStoreResult config is now deprecated replaced with blocking activation store level */
36
36
protected val disableStoreResultConfig = loadConfigOrThrow[Boolean ](ConfigKeys .disableStoreResult)
37
- protected val storeBlockingResultLevelConfig =
38
- if (disableStoreResultConfig) ActivationStoreLevel .STORE_FAILURES
39
- else ActivationStoreLevel .valueOf(loadConfigOrThrow[String ](ConfigKeys .storeBlockingResultLevel))
37
+ protected val storeBlockingResultLevelConfig = {
38
+ val configValue = ActivationStoreLevel .valueOf(loadConfigOrThrow[String ](ConfigKeys .storeBlockingResultLevel))
39
+ if (disableStoreResultConfig && configValue == ActivationStoreLevel .STORE_ALWAYS ) ActivationStoreLevel .STORE_FAILURES
40
+ else configValue
41
+ }
40
42
protected val storeNonBlockingResultLevelConfig =
41
43
ActivationStoreLevel .valueOf(loadConfigOrThrow[String ](ConfigKeys .storeNonBlockingResultLevel))
42
44
protected val unstoredLogsEnabledConfig = loadConfigOrThrow[Boolean ](ConfigKeys .unstoredLogsEnabled)
@@ -46,7 +48,7 @@ trait ActivationStore {
46
48
*
47
49
* @param activation activation to store
48
50
* @param isBlockingActivation is activation blocking
49
- * @param disableBlockingStore do not store activation if successful and blocking
51
+ * @param blockingStoreLevel do not store activation if successful and blocking
50
52
* @param nonBlockingStoreLevel do not store activation if successful and non-blocking
51
53
* @param context user and request context
52
54
* @param transid transaction ID for request
@@ -62,7 +64,7 @@ trait ActivationStore {
62
64
logging : Logging ): Future [DocInfo ] = {
63
65
if (context.user.limits.storeActivations.getOrElse(true ) &&
64
66
shouldStoreActivation(
65
- activation,
67
+ activation.response ,
66
68
isBlockingActivation,
67
69
transid.meta.extraLogging,
68
70
blockingStoreLevel.getOrElse(storeBlockingResultLevelConfig),
@@ -191,24 +193,24 @@ trait ActivationStore {
191
193
* - an activation in debug mode
192
194
* - activation stores is not disabled via a configuration parameter
193
195
*
194
- * @param activation to check
196
+ * @param activationResponse to check
195
197
* @param isBlocking is blocking activation
196
198
* @param debugMode is logging header set to "on" for the invocation
197
199
* @param blockingStoreLevel level of activation status to store for blocking invocations
198
200
* @param nonBlockingStoreLevel level of activation status to store for blocking invocations
199
201
* @return Should the activation be stored to the database
200
202
*/
201
- private def shouldStoreActivation (activation : WhiskActivation ,
203
+ private def shouldStoreActivation (activationResponse : ActivationResponse ,
202
204
isBlocking : Boolean ,
203
205
debugMode : Boolean ,
204
206
blockingStoreLevel : ActivationStoreLevel .Value ,
205
207
nonBlockingStoreLevel : ActivationStoreLevel .Value ): Boolean = {
206
208
def shouldStoreOnLevel (storageLevel : ActivationStoreLevel .Value ): Boolean = {
207
209
storageLevel match {
208
210
case ActivationStoreLevel .STORE_ALWAYS => true
209
- case ActivationStoreLevel .STORE_FAILURES => ! activation.response .isSuccess
211
+ case ActivationStoreLevel .STORE_FAILURES => ! activationResponse .isSuccess
210
212
case ActivationStoreLevel .STORE_FAILURES_NOT_APPLICATION_ERRORS =>
211
- ! activation.response.isSuccess && ! activation.response.isApplicationError
213
+ activationResponse.isContainerError || activationResponse.isWhiskError
212
214
}
213
215
}
214
216
0 commit comments