refactor: read config values dynamically instead of caching in instance variables#2610
Conversation
Summary of ChangesHello @maobaolong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors several components to eliminate the caching of configuration values in instance variables. Instead, these values are now retrieved directly from the central configuration object whenever they are needed. This change is crucial for enabling dynamic updates to configuration settings without requiring application restarts or reinitialization of components, thereby improving the system's flexibility and responsiveness to operational changes. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
fcedae1 to
8d45048
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the code to read several configuration values dynamically from the config object instead of caching them as instance variables. This is a good change that allows for dynamic configuration updates. The implementation looks correct across all modified files, consistently replacing cached attributes with direct configuration access at the usage sites. I have one minor suggestion to improve maintainability by reducing code duplication in one of the files.
…ce variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
086b3fb to
d6f364c
Compare
|
@sammshen @chunxiaozheng Would you like to take a look at this PR? Thanks! |
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…ce variables (LMCache#2610) * refactor: read config values dynamically instead of caching in instance variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Address gemini's comment Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix code quality issue Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…ce variables (LMCache#2610) * refactor: read config values dynamically instead of caching in instance variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Address gemini's comment Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix code quality issue Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…ce variables (LMCache#2610) * refactor: read config values dynamically instead of caching in instance variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Address gemini's comment Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix code quality issue Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>
…ce variables (LMCache#2610) * refactor: read config values dynamically instead of caching in instance variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Address gemini's comment Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix code quality issue Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com> Signed-off-by: shaoxiawjc <wjc2800@163.com>
…ce variables (LMCache#2610) * refactor: read config values dynamically instead of caching in instance variables Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site. Configs changed to dynamic reading: - blocking_timeout_secs (remote_backend.py) - lookup_timeout_ms (lmcache_lookup_client.py, lmcache_async_lookup_client.py) - save_decode_cache (vllm_v1_adapter.py) - force_store_wait (cache_engine.py) - save_unfull_chunk (token_database.py) - hit_miss_ratio, chunk_size (hit_limit_lookup_client.py) - ping_timeout, get_blocking_failed_threshold, waiting_time_for_recovery (remote_backend_check.py) Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Address gemini's comment Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Fix code quality issue Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com> Signed-off-by: Aaron Wu <aaron.wu@dell.com>
Remove cached instance variables for config values that should support dynamic configuration updates. Instead, read them directly from the config object at each usage site.
Configs changed to dynamic reading:
What this PR does / why we need it:
Special notes for your reviewers:
If applicable: