mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 12:28:24 +00:00
Beacon chain tasks use task executor
This commit is contained in:
@@ -6,7 +6,6 @@ edition = "2018"
|
||||
|
||||
[dev-dependencies]
|
||||
eth1_test_rig = { path = "../../testing/eth1_test_rig" }
|
||||
environment = { path = "../../lighthouse/environment" }
|
||||
toml = "0.5.6"
|
||||
web3 = "0.10.0"
|
||||
sloggers = "1.0.0"
|
||||
@@ -30,3 +29,4 @@ state_processing = { path = "../../consensus/state_processing" }
|
||||
libflate = "1.0.0"
|
||||
lighthouse_metrics = { path = "../../common/lighthouse_metrics"}
|
||||
lazy_static = "1.4.0"
|
||||
environment = { path = "../../lighthouse/environment" }
|
||||
|
||||
@@ -283,13 +283,8 @@ impl Service {
|
||||
/// - Err(_) if there is an error.
|
||||
///
|
||||
/// Emits logs for debugging and errors.
|
||||
pub fn auto_update(
|
||||
service: Self,
|
||||
handle: &tokio::runtime::Handle,
|
||||
exit: tokio::sync::oneshot::Receiver<()>,
|
||||
) {
|
||||
pub fn auto_update(service: Self, handle: environment::TaskExecutor) {
|
||||
let update_interval = Duration::from_millis(service.config().auto_update_interval_millis);
|
||||
let log = service.log.clone();
|
||||
|
||||
let mut interval = interval_at(Instant::now(), update_interval);
|
||||
|
||||
@@ -301,14 +296,7 @@ impl Service {
|
||||
}
|
||||
};
|
||||
|
||||
let exit_future = async move {
|
||||
let _ = exit.await.ok();
|
||||
info!(log, "Eth1 service shutdown");
|
||||
};
|
||||
|
||||
let future = futures::future::select(Box::pin(update_future), Box::pin(exit_future));
|
||||
|
||||
handle.spawn(future);
|
||||
handle.spawn(update_future, "eth1_service");
|
||||
}
|
||||
|
||||
async fn do_update(service: Self, update_interval: Duration) -> Result<(), ()> {
|
||||
|
||||
Reference in New Issue
Block a user