From b6a9c802d693f7d3929136fae188647d2c9662cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Schuindt?= Date: Wed, 29 Jun 2022 17:07:19 -0700 Subject: [PATCH] Improve message for payload size threshold --- .../core/utils/ExternalPayloadStorageUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/netflix/conductor/core/utils/ExternalPayloadStorageUtils.java b/core/src/main/java/com/netflix/conductor/core/utils/ExternalPayloadStorageUtils.java index eb6e862659..53a2246e26 100644 --- a/core/src/main/java/com/netflix/conductor/core/utils/ExternalPayloadStorageUtils.java +++ b/core/src/main/java/com/netflix/conductor/core/utils/ExternalPayloadStorageUtils.java @@ -122,7 +122,8 @@ public void verifyAndUpload(T entity, PayloadType payloadType) { byte[] payloadBytes = byteArrayOutputStream.toByteArray(); long payloadSize = payloadBytes.length; - if (payloadSize > maxThreshold * 1024) { + final long maxThresholdInBytes = maxThreshold * 1024; + if (payloadSize > maxThresholdInBytes) { if (entity instanceof TaskModel) { String errorMsg = String.format( @@ -130,15 +131,15 @@ public void verifyAndUpload(T entity, PayloadType payloadType) { payloadSize, ((TaskModel) entity).getTaskId(), ((TaskModel) entity).getWorkflowInstanceId(), - maxThreshold); + maxThresholdInBytes); failTask(((TaskModel) entity), payloadType, errorMsg); } else { String errorMsg = String.format( - "The output payload size: %dB of workflow: %s is greater than the permissible limit: %d bytes", + "The payload size: %d of workflow: %s is greater than the permissible limit: %d bytes", payloadSize, ((WorkflowModel) entity).getWorkflowId(), - maxThreshold); + maxThresholdInBytes); failWorkflow(((WorkflowModel) entity), payloadType, errorMsg); } } else if (payloadSize > threshold * 1024) {