Skip to content

Commit 692a293

Browse files
committed
fix: use slots to measure readiness
1 parent 65b4445 commit 692a293

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

apps/hermes/server/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/hermes/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hermes"
3-
version = "0.8.5"
3+
version = "0.8.6"
44
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
55
edition = "2021"
66

apps/hermes/server/src/state/cache.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub trait Cache {
135135
ids: Vec<FeedId>,
136136
request_time: RequestTime,
137137
filter: MessageStateFilter,
138-
) -> Result<Vec<MessageState>>;
138+
) -> Result<Vec<MessageState>>;
139139
async fn is_cache_ready(&self) -> bool;
140140
}
141141

@@ -276,18 +276,18 @@ where
276276
Ok(cache.get(&slot).cloned())
277277
}
278278

279-
/// Checks if the cache contains sufficient data to serve requests.
280-
/// Specifically, TWAP requests -- to serve a TWAP of X seconds, there
279+
/// Checks if the cache contains sufficient data to serve requests.
280+
/// Specifically, TWAP requests -- to serve a TWAP of X seconds, there
281281
/// needs to be X seconds of data in the cache. We need to serve TWAPs
282-
/// from the cache since TwapMessages only exist in Hermes at the moment,
282+
/// from the cache since TwapMessages only exist in Hermes at the moment,
283283
/// not Benchmarks.
284-
///
285-
/// The cache is considered ready when it is at or near its maximum capacity.
284+
///
285+
/// The cache is considered ready when it is at or near its maximum slot capacity.
286286
async fn is_cache_ready(&self) -> bool {
287-
let message_cache = self.into().message_cache.read().await;
288-
let cache_size = self.into().cache_size as usize;
289-
290-
message_cache.len() >= (cache_size * 9 / 10)
287+
let message_cache = self.into().accumulator_messages_cache.read().await;
288+
let max_cache_size = self.into().cache_size as usize;
289+
290+
message_cache.len() >= (max_cache_size * 9 / 10)
291291
}
292292
}
293293

0 commit comments

Comments
 (0)