Skip to content

Commit 53244fa

Browse files
committed
refactored send_Payload logic
1 parent 3da16f7 commit 53244fa

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

testnet/stacks-node/src/event_dispatcher.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -571,20 +571,18 @@ impl EventObserver {
571571
// if the observer is in lossy mode quickly send the payload without checking for the db
572572
if self.lossy {
573573
Self::send_payload_directly(payload, &full_url, self.timeout, true);
574-
} else {
575-
if let Some(db_path) = &self.db_path {
576-
let conn =
577-
Connection::open(db_path).expect("Failed to open database for event observer");
574+
} else if let Some(db_path) = &self.db_path {
575+
let conn =
576+
Connection::open(db_path).expect("Failed to open database for event observer");
578577

579-
// Insert the new payload into the database
580-
Self::insert_payload_with_retry(&conn, &full_url, payload, self.timeout);
578+
// Insert the new payload into the database
579+
Self::insert_payload_with_retry(&conn, &full_url, payload, self.timeout);
581580

582-
// Process all pending payloads
583-
Self::process_pending_payloads(&conn);
584-
} else {
585-
// No database, just send the payload
586-
Self::send_payload_directly(payload, &full_url, self.timeout, false);
587-
}
581+
// Process all pending payloads
582+
Self::process_pending_payloads(&conn);
583+
} else {
584+
// No database, just send the payload
585+
Self::send_payload_directly(payload, &full_url, self.timeout, false);
588586
}
589587
}
590588

0 commit comments

Comments
 (0)