Skip to content

Commit

Permalink
feat(task-manager): use ensureScheduling whenever the ID of the task …
Browse files Browse the repository at this point in the history
…is included in lens, maps and telemetry
  • Loading branch information
gmmorris committed Nov 12, 2019
1 parent 18542d9 commit d90a483
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/lens/server/usage/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function scheduleTasks(server: Server) {
// function block.
(async () => {
try {
await taskManager.schedule({
await taskManager.ensureScheduling({
id: TASK_ID,
taskType: TELEMETRY_TASK_TYPE,
state: { byDate: {}, suggestionsByDate: {}, saved: {}, runs: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function scheduleTask(server) {
// function block.
(async () => {
try {
await taskManager.schedule({
await taskManager.ensureScheduling({
id: TASK_ID,
taskType: TELEMETRY_TASK_TYPE,
state: { stats: {}, runs: 0 },
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/oss_telemetry/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface HapiServer {
};
task_manager: {
registerTaskDefinitions: (opts: any) => void;
schedule: (opts: any) => Promise<void>;
ensureScheduling: (opts: any) => Promise<void>;
fetch: (
opts: any
) => Promise<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function scheduleTasks(server: HapiServer) {
// function block.
(async () => {
try {
await taskManager.schedule({
await taskManager.ensureScheduling({
id: `${PLUGIN_ID}-${VIS_TELEMETRY_TASK}`,
taskType: VIS_TELEMETRY_TASK,
state: { stats: {}, runs: 0 },
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/oss_telemetry/test_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getMockKbnServer = (
xpack_main: {},
task_manager: {
registerTaskDefinitions: (opts: any) => undefined,
schedule: (opts: any) => Promise.resolve(),
ensureScheduling: (opts: any) => Promise.resolve(),
fetch: mockTaskFetch,
},
},
Expand Down

0 comments on commit d90a483

Please sign in to comment.