Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the cancellation #9705

Merged
merged 1 commit into from
Jan 21, 2022
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
Update the cancellation
  • Loading branch information
benmoriceau committed Jan 21, 2022
commit ef8f2f1d286ca0f8db2d4bf820e546035065220e
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public void run(final ConnectionUpdaterInput connectionUpdaterInput) throws Retr
} else if (workflowState.isCancelled()) {
jobCreationAndStatusUpdateActivity.jobCancelled(new JobCancelledInput(
maybeJobId.get()));
resetNewConnectionInput(connectionUpdaterInput);
} else if (workflowState.isFailed()) {
reportFailure(connectionUpdaterInput);
} else {
Expand All @@ -188,9 +189,7 @@ private void reportSuccess(final ConnectionUpdaterInput connectionUpdaterInput)
maybeAttemptId.get(),
standardSyncOutput.orElse(null)));

connectionUpdaterInput.setJobId(null);
connectionUpdaterInput.setAttemptNumber(1);
connectionUpdaterInput.setFromFailure(false);
resetNewConnectionInput(connectionUpdaterInput);
}

private void reportFailure(final ConnectionUpdaterInput connectionUpdaterInput) {
Expand All @@ -212,12 +211,16 @@ private void reportFailure(final ConnectionUpdaterInput connectionUpdaterInput)

Workflow.await(Duration.ofMinutes(1), () -> skipScheduling());

connectionUpdaterInput.setJobId(null);
connectionUpdaterInput.setAttemptNumber(1);
connectionUpdaterInput.setFromFailure(false);
resetNewConnectionInput(connectionUpdaterInput);
}
}

private void resetNewConnectionInput(ConnectionUpdaterInput connectionUpdaterInput) {
connectionUpdaterInput.setJobId(null);
connectionUpdaterInput.setAttemptNumber(1);
connectionUpdaterInput.setFromFailure(false);
}

@Override
public void submitManualSync() {
if (workflowState.isRunning()) {
Expand Down