use of com.netflix.conductor.common.utils.RetryUtil in project conductor by Netflix.
the class CassandraExecutionDAO method updateTaskDefLimit.
@VisibleForTesting
void updateTaskDefLimit(Task task, boolean forceRemove) {
try {
if (task.getStatus().isTerminal() || forceRemove) {
recordCassandraDaoRequests("removeTaskDefLimit", task.getTaskType(), task.getWorkflowType());
session.execute(deleteTaskDefLimitStatement.bind(task.getTaskDefName(), UUID.fromString(task.getTaskId())));
new RetryUtil<>().retryOnException(() -> session.execute(deleteTaskDefLimitStatement.bind(task.getTaskDefName(), UUID.fromString(task.getTaskId()))), null, null, 3, "Deleting taskDefLimit", "removeTaskDefLimit");
} else if (task.getStatus().equals(IN_PROGRESS)) {
recordCassandraDaoRequests("addTaskDefLimit", task.getTaskType(), task.getWorkflowType());
new RetryUtil<>().retryOnException(() -> session.execute(updateTaskDefLimitStatement.bind(UUID.fromString(task.getWorkflowInstanceId()), task.getTaskDefName(), UUID.fromString(task.getTaskId()))), null, null, 3, "Adding taskDefLimit", "addTaskDefLimit");
}
} catch (Exception e) {
Monitors.error(CLASS_NAME, "updateTaskDefLimit");
String errorMsg = String.format("Error updating taskDefLimit for task - %s:%s in workflow: %s", task.getTaskDefName(), task.getTaskId(), task.getWorkflowInstanceId());
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
}
}
Aggregations