Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Improve message for payload size threshold calculation #3075

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,24 @@ public <T> 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(
"The payload size: %d of task: %s in workflow: %s is greater than the permissible limit: %d bytes",
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) {
Expand Down