Repository navigation
[fix] stop ListRoutes refreshing the instance cache - #644
Merged
Merged
Conversation
* Read the instance cache without checking its TTL, so route reconciles no longer re-list account instances and VPC IPs about every 20s. * Copy the cache under its read lock, fixing a data race with refreshes. * A node missing from the cache triggers CreateRoute, which refreshes an expired cache via LookupLinode; periodic node controller lookups keep the cache fresh.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in cache synchronization or refresh behavior; tests were not executed.
0 open findings
What changed in this PR
Reduces Linode API calls during route reconciliation by reusing cached instances, complementing #642’s lookup reductions.
Changes:
- Loads instances only when the cache has never been populated.
- Copies cached instances under a read lock to prevent races.
- Adds cache behavior tests and initializes the route test’s node cache.
| File | Description |
|---|---|
| cloud/linode/services/instances.go | Adds initialization-only loading and synchronized cache reads. |
| cloud/linode/services/instances_test.go | Tests initialization, expired-cache reuse, failures, and concurrency. |
| cloud/linode/route_controller.go | Uses cached instances without TTL-triggered refreshes. |
| cloud/linode/route_controller_test.go | Initializes and restores the registered node cache. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #644 +/- ##
==========================================
+ Coverage 82.59% 82.64% +0.05%
==========================================
Files 19 19
Lines 2608 2616 +8
==========================================
+ Hits 2154 2162 +8
Misses 454 454 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Combined with #642, here's what I see in a quick back to back from metrics:
General:
Pull Request Guidelines: