mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-29 05:53:48 +03:00
improvement: stop prev event fetching if too many events fail
This commit is contained in:
parent
b9eb39a9c6
commit
33738dbbc2
1 changed files with 5 additions and 0 deletions
|
@ -1084,7 +1084,11 @@ pub(crate) async fn handle_incoming_pdu<'a>(
|
||||||
})
|
})
|
||||||
.map_err(|_| "Error sorting prev events".to_owned())?;
|
.map_err(|_| "Error sorting prev events".to_owned())?;
|
||||||
|
|
||||||
|
let mut errors = 0;
|
||||||
for prev_id in dbg!(sorted) {
|
for prev_id in dbg!(sorted) {
|
||||||
|
if errors >= 5 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if let Some((pdu, json)) = eventid_info.remove(&prev_id) {
|
if let Some((pdu, json)) = eventid_info.remove(&prev_id) {
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
let event_id = pdu.event_id.clone();
|
let event_id = pdu.event_id.clone();
|
||||||
|
@ -1099,6 +1103,7 @@ pub(crate) async fn handle_incoming_pdu<'a>(
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
errors += 1;
|
||||||
warn!("Prev event {} failed: {}", event_id, e);
|
warn!("Prev event {} failed: {}", event_id, e);
|
||||||
}
|
}
|
||||||
let elapsed = start_time.elapsed();
|
let elapsed = start_time.elapsed();
|
||||||
|
|
Loading…
Reference in a new issue