Skip to content
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "Do not run afterExecuteOperation if the operation has not actually completed.",
"type": "none",
"packageName": "@microsoft/rush"
}
],
"packageName": "@microsoft/rush",
"email": "aramissennyeydd@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,19 @@ export class OperationExecutionManager {
const onOperationCompleteAsync: (record: OperationExecutionRecord) => Promise<void> = async (
record: OperationExecutionRecord
) => {
try {
await this._afterExecuteOperation?.(record);
} catch (e) {
this._reportOperationErrorIfAny(record);
record.error = e;
record.status = OperationStatus.Failure;
// If the operation is not terminal, we should _only_ notify the queue to assign operations.
if (!record.isTerminal) {
this._executionQueue.assignOperations();
} else {
try {
await this._afterExecuteOperation?.(record);
} catch (e) {
this._reportOperationErrorIfAny(record);
record.error = e;
record.status = OperationStatus.Failure;
}
this._onOperationComplete(record);
}
this._onOperationComplete(record);
};

const onOperationStartAsync: (
Expand All @@ -296,8 +301,8 @@ export class OperationExecutionManager {
const status: OperationStatus = this._hasAnyFailures
? OperationStatus.Failure
: this._hasAnyNonAllowedWarnings
? OperationStatus.SuccessWithWarning
: OperationStatus.Success;
? OperationStatus.SuccessWithWarning
: OperationStatus.Success;

return {
operationResults: this._executionRecords,
Expand Down Expand Up @@ -431,13 +436,12 @@ export class OperationExecutionManager {
this._hasAnyNonAllowedWarnings = this._hasAnyNonAllowedWarnings || !runner.warningsAreAllowed;
break;
}
}

if (record.isTerminal) {
// If the operation was not remote, then we can notify queue that it is complete
this._executionQueue.complete(record);
} else {
this._executionQueue.assignOperations();
default: {
throw new InternalError(`Unexpected operation status: ${status}`);
}
}

this._executionQueue.complete(record);
}
}