mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Add TODOS
This commit is contained in:
@@ -52,6 +52,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
|||||||
// TODO: `Return type of closure passed to `for_each` is restricted to `Future<Output = ()>`
|
// TODO: `Return type of closure passed to `for_each` is restricted to `Future<Output = ()>`
|
||||||
// Hence, shifting the .then() error logs into the `for_each` closure.
|
// Hence, shifting the .then() error logs into the `for_each` closure.
|
||||||
// Can be solved with `TryStreamExt::try_for_each` if `Interval` implemented `TryStream`.
|
// Can be solved with `TryStreamExt::try_for_each` if `Interval` implemented `TryStream`.
|
||||||
|
// Check if this can be refactored better.
|
||||||
let interval_future = interval_at(start_instant, interval_duration).for_each(|_| {
|
let interval_future = interval_at(start_instant, interval_duration).for_each(|_| {
|
||||||
let connected_peer_count = network.connected_peers();
|
let connected_peer_count = network.connected_peers();
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
|||||||
|
|
||||||
let future = futures::future::select(interval_future, exit.map_err(|_| ()).map(|_| ()));
|
let future = futures::future::select(interval_future, exit.map_err(|_| ()).map(|_| ()));
|
||||||
|
|
||||||
// TODO: the runtime handle should spawn this future.
|
// TODO: check if the runtime handle should spawn this future.
|
||||||
tokio::task::spawn(future);
|
tokio::task::spawn(future);
|
||||||
|
|
||||||
Ok(exit_signal)
|
Ok(exit_signal)
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ use tokio::runtime::Handle;
|
|||||||
use tokio::time::{interval_at, Instant};
|
use tokio::time::{interval_at, Instant};
|
||||||
|
|
||||||
/// Spawns a timer service which periodically executes tasks for the beacon chain
|
/// Spawns a timer service which periodically executes tasks for the beacon chain
|
||||||
pub async fn spawn<T: BeaconChainTypes>(
|
/// TODO: We might not need a `Handle` to the runtime since this function should be
|
||||||
|
/// called from the context of a runtime and we can simply spawn using task::spawn.
|
||||||
|
/// Check for issues without the Handle.
|
||||||
|
pub fn spawn<T: BeaconChainTypes>(
|
||||||
handle: &Handle,
|
handle: &Handle,
|
||||||
beacon_chain: Arc<BeaconChain<T>>,
|
beacon_chain: Arc<BeaconChain<T>>,
|
||||||
milliseconds_per_slot: u64,
|
milliseconds_per_slot: u64,
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ pub fn start_server<T: EthSpec>(
|
|||||||
|
|
||||||
// Place a future on the handle that will shutdown the websocket server when the
|
// Place a future on the handle that will shutdown the websocket server when the
|
||||||
// application exits.
|
// application exits.
|
||||||
|
// TODO: check if we should spawn using a `Handle` or using `task::spawn`
|
||||||
handle.spawn(exit_future);
|
handle.spawn(exit_future);
|
||||||
|
|
||||||
exit_channel
|
exit_channel
|
||||||
@@ -99,7 +100,7 @@ pub fn start_server<T: EthSpec>(
|
|||||||
|
|
||||||
let log_inner = log.clone();
|
let log_inner = log.clone();
|
||||||
// TODO: using tokio `spawn_blocking` instead of `thread::spawn`
|
// TODO: using tokio `spawn_blocking` instead of `thread::spawn`
|
||||||
// Check which is more apt
|
// Check which is more apt.
|
||||||
let _handle = tokio::task::spawn_blocking(move || match server.run() {
|
let _handle = tokio::task::spawn_blocking(move || match server.run() {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
debug!(
|
debug!(
|
||||||
|
|||||||
Reference in New Issue
Block a user