-
Notifications
You must be signed in to change notification settings - Fork 129
chore(pegboard): only refresh serverless runner metadata when new or udpated endpoint #3227
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
chore(pegboard): only refresh serverless runner metadata when new or udpated endpoint #3227
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
e03c5e3 to
b947e15
Compare
commit: |
Pull Request ReviewSummaryThis PR optimizes the serverless runner configuration upsert flow by only refreshing runner metadata when the endpoint configuration (URL or headers) has actually changed. This is a good performance optimization that avoids unnecessary external HTTP calls. Code Quality & Best Practices ✅Strengths:
Observations:
Potential Issues 🔍1. HashMap comparison may be order-dependent (Low Priority) endpoint_config_changed = old_url != new_url || old_headers != new_headers;While Rust's
This is likely fine since the validation in the same file (lines 92-113) already trims and validates headers, but consider if this could cause unnecessary metadata refreshes. 2. Edge case: Multiple datacenters with different configs 3. Missing OpenAPI response schema update Performance Considerations ✅Positive Impact:
Efficiency:
Security Concerns ✅No issues identified:
Test Coverage
|
b947e15 to
273df8b
Compare
PR Review: Only refresh serverless runner metadata when endpoint changesOverviewThis PR optimizes the runner config upsert operation by tracking whether the serverless endpoint configuration has changed, and only refreshing metadata from the remote endpoint when necessary. This is a good performance optimization that reduces unnecessary network calls. Code Quality ✅Strengths:
Minor observations:
Logic & Correctness ✅Change detection logic (packages/services/namespace/src/ops/runner_config/upsert.rs:24-57):
Multi-datacenter handling (packages/core/api-public/src/runner_configs/upsert.rs:88-116):
Potential Issues
|
273df8b to
d8a19e4
Compare
PR Review: Optimize serverless runner metadata refreshSummaryThis PR adds an optimization to only refresh serverless runner metadata when the endpoint configuration (URL or headers) has actually changed, avoiding unnecessary metadata refresh calls on every upsert operation. Code Quality & Best Practices ✅Strengths:
Adherence to CLAUDE.md conventions:
Logic AnalysisThe change detection logic (lines 35-53 in The implementation correctly identifies when endpoint config has changed:
Minor Issue - Incomplete change detection: The current logic only compares
Question: Should changes to these fields also trigger a metadata refresh? Looking at the code, these appear to be scaling/configuration parameters that might not affect the metadata endpoint response. However, if the metadata endpoint uses any of these values as context, they should be included in the comparison. Recommendation: Add a comment explaining why only Potential Issues1. Multi-datacenter consistency 🟡 In if response.endpoint_config_changed {
any_endpoint_config_changed = true;
}Scenario: If configs differ across datacenters initially and only one datacenter changes, this could lead to:
However, there's a subtle edge case: The serverless config is extracted before the datacenter loop (lines 70-86). If different datacenters have different serverless configs, only the first one found will be used for metadata refresh. This might be intentional (perhaps serverless configs must be identical across DCs), but worth documenting. 2. Namespace resolution timing ✅ Good catch moving namespace resolution earlier (lines 62-68)! This ensures the namespace exists before attempting any upserts, providing better error handling. Performance Considerations ✅Positive impact:
No performance concerns identified. Security Considerations ✅No security issues identified:
Test Coverage 🟡Missing test coverage: This change would benefit from tests covering:
Recommendation: Add integration tests to verify the optimization works as expected. Minor Code Quality Suggestions1. Type safety for change detection Consider extracting the endpoint comparison into a helper method: impl RunnerConfigKind {
fn endpoint_config_eq(&self, other: &Self) -> bool {
match (self, other) {
(
RunnerConfigKind::Serverless { url: url1, headers: headers1, .. },
RunnerConfigKind::Serverless { url: url2, headers: headers2, .. },
) => url1 == url2 && headers1 == headers2,
_ => false,
}
}
}This would make the intent clearer and easier to test. 2. Log message consistency Line 74: Changed .filter_map(|(_dc_name, runner_config)| {
// Could be:
.filter_map(|(_, runner_config)| {OpenAPI Schema ✅The OpenAPI change correctly adds the new response field with proper typing:
This is a breaking change to the API contract, but appears intentional. Overall AssessmentStrong PR with one clarification needed: ✅ Approve with minor suggestions The optimization is well-implemented and will provide tangible performance benefits by avoiding unnecessary metadata refresh calls. The logic is sound, though I'd recommend:
Great work on this optimization! Review generated with attention to the codebase conventions in CLAUDE.md |

No description provided.