Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedodson committed Mar 4, 2022
1 parent 7317156 commit 82329e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions x-pack/plugins/task_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ export class TaskManagerPlugin
startServicesPromise.then(({ elasticsearch }) => elasticsearch.client),
});

router.post({ path: '/api/task_manager/_stop', validate: false }, async (context, req, res) => {
this.taskPollingLifecycle!.stop();
return res.ok({ body: `Aye, aye, captain` });
});

core.status.derivedStatus$.subscribe((status) =>
this.logger.debug(`status core.status.derivedStatus now set to ${status.level}`)
);
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/task_manager/server/polling_lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ export class TaskPollingLifecycle {
});
}

public stop() {
this.taskClaiming.excludedTaskTypes = ['*'];
}

public get events(): Observable<TaskLifecycleEvent> {
return this.events$;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class TaskClaiming {
private logger: Logger;
private readonly taskClaimingBatchesByType: TaskClaimingBatches;
private readonly taskMaxAttempts: Record<string, number>;
private readonly excludedTaskTypes: string[];
public readonly excludedTaskTypes: string[];
private readonly unusedTypes: string[];

/**
Expand Down

0 comments on commit 82329e7

Please sign in to comment.