Skip to content

Commit

Permalink
add return value
Browse files Browse the repository at this point in the history
  • Loading branch information
flipswitchingmonkey committed Aug 18, 2023
1 parent badf96d commit a6bf262
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,10 @@ export class ActiveWorkflowRunner implements IWebhookManager {
// if it's active in memory then it's a trigger
// so remove from list of actives workflows
if (this.activeWorkflows.isActive(workflowId)) {
await this.activeWorkflows.remove(workflowId);
Logger.verbose(`Successfully deactivated workflow "${workflowId}"`, { workflowId });
const removalSuccess = await this.activeWorkflows.remove(workflowId);
if (removalSuccess) {
Logger.verbose(`Successfully deactivated workflow "${workflowId}"`, { workflowId });
}
}
}
}
6 changes: 4 additions & 2 deletions packages/core/src/ActiveWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ export class ActiveWorkflows {
*
* @param {string} id The id of the workflow to deactivate
*/
async remove(id: string): Promise<void> {
async remove(id: string): Promise<boolean> {
if (!this.isActive(id)) {
// Workflow is currently not registered
Logger.warn(
`The workflow with the id "${id}" is currently not active and can so not be removed`,
);
return;
return false;
}

const workflowData = this.workflowData[id];
Expand Down Expand Up @@ -245,5 +245,7 @@ export class ActiveWorkflows {
}

delete this.workflowData[id];

return true;
}
}

0 comments on commit a6bf262

Please sign in to comment.