mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 06:44:35 +00:00
Beacon chain tasks use task executor
This commit is contained in:
@@ -12,3 +12,4 @@ tokio = { version = "0.2.21", features = ["full"] }
|
||||
slog = "2.5.2"
|
||||
parking_lot = "0.10.2"
|
||||
futures = "0.3.5"
|
||||
environment = { path = "../../lighthouse/environment" }
|
||||
|
||||
@@ -13,7 +13,7 @@ use tokio::time::{interval_at, Instant};
|
||||
|
||||
/// Spawns a timer service which periodically executes tasks for the beacon chain
|
||||
pub fn spawn<T: BeaconChainTypes>(
|
||||
handle: &Handle,
|
||||
handle: environment::TaskExecutor,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
milliseconds_per_slot: u64,
|
||||
log: slog::Logger,
|
||||
@@ -34,14 +34,7 @@ pub fn spawn<T: BeaconChainTypes>(
|
||||
}
|
||||
};
|
||||
|
||||
let log_1 = log.clone();
|
||||
let exit_future = async move {
|
||||
let _ = exit.await.ok();
|
||||
info!(log_1, "Timer service shutdown");
|
||||
};
|
||||
|
||||
let future = futures::future::select(Box::pin(timer_future), Box::pin(exit_future));
|
||||
handle.spawn(future);
|
||||
handle.spawn(timer_future, "timer_service");
|
||||
info!(log, "Timer service started");
|
||||
|
||||
Ok(exit_signal)
|
||||
|
||||
Reference in New Issue
Block a user