Skip to content

Commit

Permalink
added more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Aug 6, 2020
1 parent 4466a66 commit 5be9f70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x-pack/plugins/task_manager/server/task_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ export class TaskManager {
taskInstance: TaskInstanceWithDeprecatedFields,
options?: object
): Promise<ConcreteTaskInstance> {
if (taskInstance?.scope?.includes('alerting')) {
console.log(
`:::::: TaskManager.schedule(${taskInstance.params?.alertId}) [availableWorkers=${this.pool.availableWorkers}]`
);
}
await this.waitUntilStarted();
const { taskInstance: modifiedTask } = await this.middleware.beforeSave({
...options,
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/task_manager/server/task_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ export class TaskStore {
{ id: taskInstance.id, refresh: false }
);

if (taskInstance?.scope?.includes('alerting')) {
console.log(`:::::: TaskStore.schedule(${taskInstance.params?.alertId})`);
console.log(`:::::: ${JSON.stringify(savedObject)}`);
}

return savedObjectToConcreteTaskInstance(savedObject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,17 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts');

console.log('scheduled with interval of 30m');

await retry.try(async () => {
const alertTask = await getAlertingTaskById(createdAlert.scheduledTaskId);
expect(alertTask.status).to.eql('idle');
// ensure the alert inital run has completed and it's been rescheduled to half an hour from now
ensureDatetimeIsWithinRange(Date.parse(alertTask.runAt), 30 * 60 * 1000);
});

console.log('has been rescheduled after first run');

await ensureTasksIndexRefreshed();

const updatedData = {
Expand Down

0 comments on commit 5be9f70

Please sign in to comment.