Skip to content

fix: serialize resource discovery per context#81

Open
leno23 wants to merge 1 commit into
ndenev:masterfrom
leno23:fix/context-discovery-locks
Open

fix: serialize resource discovery per context#81
leno23 wants to merge 1 commit into
ndenev:masterfrom
leno23:fix/context-discovery-locks

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • Add a per-context async mutex map to K8sClientPool so discovery/refresh calls for the same Kubernetes context cannot race each other.
  • Keep discoveries for different contexts parallel by locking only the requested context key.
  • Re-check the in-memory registry cache after acquiring the context lock, so a waiting non-force discovery can reuse the fresher registry written by the call that just completed.

Fixes #76

Testing

  • cargo fmt --check
  • git diff --check
  • cargo test discovery_lock_is_per_context -- --nocapture
  • cargo check
  • Attempted cargo clippy --all-targets --all-features -- -D warnings; it reaches existing unrelated warnings in src/cli/repl.rs (collapsible_match) and src/datafusion_integration/hooks.rs (default_constructed_unit_structs) after this change compiles successfully.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race: concurrent discovery can overwrite fresher registry for same context

1 participant