mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Limit stagnant checks to a certain amount of entries (#5742)
* Limit number of elements loaded from the stagnant key This will likely be required if we enable stagnant prunning as currently database has way too many entries to be prunned in a single iteration * Fmt run * Slightly improve logging * Some more debug nits * Fmt pass
This commit is contained in:
@@ -139,13 +139,16 @@ impl Backend for TestBackend {
|
||||
fn load_stagnant_at_up_to(
|
||||
&self,
|
||||
up_to: Timestamp,
|
||||
max_elements: usize,
|
||||
) -> Result<Vec<(Timestamp, Vec<Hash>)>, Error> {
|
||||
Ok(self
|
||||
.inner
|
||||
.lock()
|
||||
.stagnant_at
|
||||
.range(..=up_to)
|
||||
.map(|(t, v)| (*t, v.clone()))
|
||||
.enumerate()
|
||||
.take_while(|(idx, _)| *idx < max_elements)
|
||||
.map(|(_, (t, v))| (*t, v.clone()))
|
||||
.collect())
|
||||
}
|
||||
fn load_first_block_number(&self) -> Result<Option<BlockNumber>, Error> {
|
||||
|
||||
Reference in New Issue
Block a user