-
Notifications
You must be signed in to change notification settings - Fork 243
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
fix: ready endpoint already checks for fully hydrated cache #2553
base: main
Are you sure you want to change the base?
Conversation
Co-Authored-By: Tejas Badadare <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 6 Skipped Deployments
|
Co-Authored-By: Tejas Badadare <[email protected]>
Co-Authored-By: Tejas Badadare <[email protected]>
Co-Authored-By: Tejas Badadare <[email protected]>
Co-Authored-By: Tejas Badadare <[email protected]>
Co-Authored-By: Tejas Badadare <[email protected]>
async fn is_cache_ready(&self) -> bool { | ||
let message_cache = self.into().message_cache.read().await; | ||
!message_cache.is_empty() | ||
} |
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.
The cache should be considered "ready" if it's full, not just if it's non-empty. See the store_accumulator_messages() impl for an example of checking if the cache is full.
Co-Authored-By: Tejas Badadare <[email protected]>
@@ -274,6 +275,14 @@ where | |||
let cache = self.into().wormhole_merkle_state_cache.read().await; | |||
Ok(cache.get(&slot).cloned()) | |||
} | |||
|
|||
/// |
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.
you forgot to finish this docstring
Co-Authored-By: Tejas Badadare <[email protected]>
Add is_ready() Method to Cache Trait and Update Ready Endpoint
Description
This PR updates the Hermes
/ready
endpoint to return OK only when the cache is fully hydrated by:is_ready()
method to theCache
trait that checks if the cache contains sufficient data to serve requests/ready
endpoint to check both the aggregate readiness and cache readinessThe cache is now considered fully hydrated when all of the following conditions are met:
has_completed_recently
: The latest completed update is recent (within the staleness threshold)is_not_behind
: The latest completed slot isn't too far behind the latest observed slotis_metadata_loaded
: Price feeds metadata is not emptyCache::is_ready()
method)Link to Devin run
https://app.devin.ai/sessions/7467a93d13ab41adb52d38f5d6404e21
Requested by
Tejas Badadare ([email protected])