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

Commit

Permalink
fix for retry when using external payload storage
Browse files Browse the repository at this point in the history
  • Loading branch information
apanicker-nflx committed Apr 5, 2019
1 parent 6dc08cb commit 1a2e621
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -224,8 +224,9 @@ public void updateTask(TaskResult taskResult, String taskType) {
Preconditions.checkNotNull(taskResult, "Task result cannot be null");
Preconditions.checkArgument(StringUtils.isBlank(taskResult.getExternalOutputPayloadStoragePath()), "External Storage Path must not be set");

Map<String, Object> outputData = taskResult.getOutputData();
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
objectMapper.writeValue(byteArrayOutputStream, taskResult.getOutputData());
objectMapper.writeValue(byteArrayOutputStream, outputData);
byte[] taskOutputBytes = byteArrayOutputStream.toByteArray();
long taskResultSize = taskOutputBytes.length;
WorkflowTaskMetrics.recordTaskResultPayloadSize(taskType, taskResultSize);
Expand All @@ -247,6 +248,9 @@ public void updateTask(TaskResult taskResult, String taskType) {
} catch (IOException e) {
String errorMsg = String.format("Unable to update task: %s with task result", taskResult.getTaskId());
logger.error(errorMsg, e);
// reset output data and external output storage payload path
taskResult.setOutputData(outputData);
taskResult.setExternalOutputPayloadStoragePath(null);
throw new ConductorClientException(errorMsg, e);
}
postForEntityWithRequestOnly("tasks", taskResult);
Expand Down

0 comments on commit 1a2e621

Please sign in to comment.