-
Notifications
You must be signed in to change notification settings - Fork 21
Allow callers to cancel their request to cancel the script #1085
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,37 +34,43 @@ Task<ScriptExecutionResult> ExecuteScript( | |
CancellationToken scriptExecutionCancellationToken); | ||
|
||
/// <summary> | ||
/// Start the script. | ||
/// | ||
/// </summary> | ||
/// <param name="command"></param> | ||
/// <param name="startScriptIsBeingReAttempted"></param> | ||
/// <param name="logger"></param> | ||
/// <param name="requestCancellationToken">Cancels the inflight request</param> | ||
/// <returns>The result, which includes the CommandContext for the next command</returns> | ||
Task<ScriptOperationExecutionResult> StartScript(ExecuteScriptCommand command, | ||
StartScriptIsBeingReAttempted startScriptIsBeingReAttempted, | ||
ITentacleClientTaskLog logger, | ||
CancellationToken scriptExecutionCancellationToken); | ||
CancellationToken requestCancellationToken); | ||
|
||
|
||
/// <summary> | ||
/// Get the status. | ||
/// </summary> | ||
/// <param name="commandContext">The CommandContext from the previous command</param> | ||
/// <param name="logger"></param> | ||
/// <param name="scriptExecutionCancellationToken"></param> | ||
/// <param name="requestCancellationToken">Cancels the inflight request</param> | ||
/// <returns>The result, which includes the CommandContext for the next command</returns> | ||
Task<ScriptOperationExecutionResult> GetStatus(CommandContext commandContext, ITentacleClientTaskLog logger, CancellationToken scriptExecutionCancellationToken); | ||
Task<ScriptOperationExecutionResult> GetStatus(CommandContext commandContext, ITentacleClientTaskLog logger, CancellationToken requestCancellationToken); | ||
|
||
/// <summary> | ||
/// Cancel the script. | ||
/// </summary> | ||
/// <param name="commandContext">The CommandContext from the previous command</param> | ||
/// <param name="logger"></param> | ||
/// <param name="requestCancellationToken">Cancels the inflight request</param> | ||
/// <returns>The result, which includes the CommandContext for the next command</returns> | ||
Task<ScriptOperationExecutionResult> CancelScript(CommandContext commandContext, ITentacleClientTaskLog logger); | ||
Task<ScriptOperationExecutionResult> CancelScript(CommandContext commandContext, ITentacleClientTaskLog logger, CancellationToken requestCancellationToken); | ||
|
||
/// <summary> | ||
/// Complete the script. | ||
/// </summary> | ||
/// <param name="commandContext">The CommandContext from the previous command</param> | ||
/// <param name="logger"></param> | ||
/// <param name="scriptExecutionCancellationToken"></param> | ||
Task<ScriptStatus?> CompleteScript(CommandContext commandContext, ITentacleClientTaskLog logger, CancellationToken scriptExecutionCancellationToken); | ||
/// <param name="requestCancellationToken">Cancels the inflight request</param> | ||
Task<ScriptStatus?> CompleteScript(CommandContext commandContext, ITentacleClientTaskLog logger, CancellationToken requestCancellationToken); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering, what's the consequence of killing a request to cancel? I would have thought this would result in the tentacle potentially running the script after we have told the user that we are cancelled, right? Is this going to be an issue? I.e., is the trade off of shutting down Octopus Server quicker worth it? |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,8 @@ async Task<ScriptOperationExecutionResult> ObserveUntilComplete( | |
{ | ||
if (scriptExecutionCancellationToken.IsCancellationRequested) | ||
{ | ||
lastResult = await scriptExecutor.CancelScript(lastResult.ContextForNextCommand).ConfigureAwait(false); | ||
// We don't want to cancel this operation as it is responsible for stopping the script executing on the Tentacle | ||
lastResult = await scriptExecutor.CancelScript(lastResult.ContextForNextCommand, CancellationToken.None).ConfigureAwait(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason for this PR is so that we can cancel the cancellation request, so that the cancellation request does not block Octopus Server from shutting down. But this made me wonder, why is this not an issue for the non-resilient pipeline? Surely it would get told to cancel a running deployment when it shuts down too, right? I would have thought that would also block. |
||
} | ||
else | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we delete this summary? Yeah, it's simple, but it's better than none.