-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Replace TaskManager's runNow with runSoon #134324
Replace TaskManager's runNow with runSoon #134324
Conversation
plugins.taskManager.runNow(TASK_ID); | ||
scheduleDashboardTelemetry(this.logger, plugins.taskManager)!.then(() => { | ||
plugins.taskManager.runSoon(TASK_ID); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we switch to pull model with runSoon, we have to wait the task to be created before trying to run it.
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/apm-ui (Team:apm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review looks good so far! Left a comment about adding a .catch
to handle errors and whether we should be trying to run failed
tasks
x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts
Show resolved
Hide resolved
src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts
Outdated
Show resolved
Hide resolved
…550-replace-run-now
x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APM changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! Ran this locally and ensured that the dashboard telemetry task was run as scheduled. Code changes also look good!
…550-replace-run-now
…550-replace-run-now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more minor comments about tests and doc and then it sounds like we should also be running failed
tasks with runSoon
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM after Ying's comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding the tests!
💛 Build succeeded, but was flakyFailed CI StepsTest Failures
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
fixes: #133550
This PR intends to replace
runNow
method of task manager withrunSoon
.runSoon gets the task and check if it's idle. If so, updates the task runAt and scheduledAt properties so it would be picked up by the Task Manager at the first run cycle.
runSoon uses pull method while runNow uses push (RxJS). Therefore i had to add some retry.try checks to the tests to be sure that the task is finished.