Skip to content

Commit

Permalink
Modify rpc_completed_slot_service to be non-blocking (solana-labs#24007)
Browse files Browse the repository at this point in the history
* timeout for validator exits

* clippy

* print backtrace when panic

* add backtrace package

* increase time out to 30s

* debug logging

* make rpc complete service non blocking

* reduce log level

* remove logging

* recv_timeout

* remove backtrace

* remove sleep

* remove unused variable

* add comments

* Update core/src/validator.rs

Co-authored-by: Trent Nelson <[email protected]>

* Update core/src/validator.rs

Co-authored-by: Trent Nelson <[email protected]>

* whitespace

* more whitespace

* fix build

Co-authored-by: Trent Nelson <[email protected]>
  • Loading branch information
2 people authored and Noah Gundotra committed Apr 2, 2022
1 parent 72577b8 commit 6128b0c
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions rpc/src/rpc_completed_slots_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,19 @@ impl RpcCompletedSlotsService {
Builder::new()
.name("solana-rpc-completed-slots-service".to_string())
.spawn(move || loop {
// received exit signal, shutdown the service
// shutdown the service
if exit.load(Ordering::Relaxed) {
break;
}

match completed_slots_receiver
if let Ok(slots) = completed_slots_receiver
.recv_timeout(Duration::from_millis(COMPLETE_SLOT_REPORT_SLEEP_MS))
{
Err(RecvTimeoutError::Timeout) => {}
Err(RecvTimeoutError::Disconnected) => {
info!("RpcCompletedSlotService channel disconnected, exiting.");
break;
}
Ok(slots) => {
for slot in slots {
rpc_subscriptions.notify_slot_update(SlotUpdate::Completed {
slot,
timestamp: timestamp(),
});
}
for slot in slots {
rpc_subscriptions.notify_slot_update(SlotUpdate::Completed {
slot,
timestamp: timestamp(),
});
}
}
})
Expand Down

0 comments on commit 6128b0c

Please sign in to comment.