Skip to content
Closed
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
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 excludedTaskTypes: string[];
private readonly unusedTypes: string[];

/**
Expand Down