-
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
[Task Manager] Add caching to the task partitioning logic #189562
Conversation
/ci |
…na into alerting/cache-partitions
/ci |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6647[✅] x-pack/test/task_manager_claimer_mget/config.ts: 25/25 tests passed. |
Pinging @elastic/response-ops (Team:ResponseOps) |
x-pack/plugins/task_manager/server/lib/task_partitioner.test.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.
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.
Left some comments about error handling, otherwise LGTM
|
||
// update the pod partitions cache after 10 seconds | ||
if (now - lastUpdated >= CACHE_INTERVAL) { | ||
const allPodNames = await this.getAllPodNames(); |
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.
If there's an error retrieving this, should we return the cached partitions?
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.
Yeah that sounds good, resolved in this commit e39827c
@@ -67,4 +76,19 @@ describe('getPartitions()', () => { | |||
247, 249, 250, 252, 253, 255, | |||
]); | |||
}); | |||
|
|||
test('correctly caches the partitions on 10 second interval ', async () => { |
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.
Can we add a test for handling errors from the discovery service?
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.
Sure, resolved in this commit e39827c
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Resolves #189119
Summary
This PR adds a mechanism to keep the node's calculated partitions in cache for 10 seconds before calling the discovery service again and recalculating them.
Checklist
To verify