Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskManager tasks scheduled without attempting to run #62078

Merged
merged 4 commits into from
Apr 10, 2020
Merged
Changes from 3 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
12 changes: 5 additions & 7 deletions x-pack/plugins/task_manager/server/task_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { filter } from 'rxjs/operators';
import { performance } from 'perf_hooks';

import { pipe } from 'fp-ts/lib/pipeable';
import { Option, none, some, map as mapOptional } from 'fp-ts/lib/Option';
import { Option, some, map as mapOptional } from 'fp-ts/lib/Option';
import {
SavedObjectsSerializer,
IScopedClusterClient,
Expand Down Expand Up @@ -156,8 +156,8 @@ export class TaskManager {
this.events$.next(event);
};

private attemptToRun(task: Option<string> = none) {
this.claimRequests$.next(task);
private attemptToRun(task: string) {
this.claimRequests$.next(some(task));
}

private createTaskRunnerForTask = (instance: ConcreteTaskInstance) => {
Expand Down Expand Up @@ -280,9 +280,7 @@ export class TaskManager {
...options,
taskInstance: ensureDeprecatedFieldsAreCorrected(taskInstance, this.logger),
});
const result = await this.store.schedule(modifiedTask);
this.attemptToRun();
return result;
return await this.store.schedule(modifiedTask);
}

/**
Expand All @@ -298,7 +296,7 @@ export class TaskManager {
.then(resolve)
.catch(reject);

this.attemptToRun(some(taskId));
this.attemptToRun(taskId);
});
}

Expand Down