Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed Metrics from the Event Loop #679

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Removed Metrics from the Event Loop #679

merged 2 commits into from
Aug 27, 2024

Conversation

momosh-ethernal
Copy link
Contributor

No description provided.

@@ -98,7 +98,13 @@ async fn run(
)
.await?;

spawn_in_span(shutdown.with_cancel(p2p_event_loop.run(ot_metrics.clone())));
spawn_in_span(shutdown.with_cancel(p2p_event_loop.run()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should run event loop after the call to resubscribe to avoid skipping an event.

let metrics_clone = ot_metrics.clone();
tokio::spawn(async move {
let stream = BroadcastStream::new(event_receiver.resubscribe());
metrics_clone.handle_event_stream(stream).await
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create stream in the handle_event_stream so we can reduce code in the main fn to:

tokio::spawn(metrics_clone.handle_event_stream(event_receiver.resubscribe()))

core/src/network/p2p/event_loop.rs Show resolved Hide resolved
@@ -100,7 +101,13 @@ async fn run(config: Config, db: DB, shutdown: Controller<String>) -> Result<()>
)
.await?;

spawn_in_span(shutdown.with_cancel(p2p_event_loop.run(ot_metrics.clone())));
spawn_in_span(shutdown.with_cancel(p2p_event_loop.run()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for this run, lets move it after resubscribe.

fat/src/main.rs Outdated
@@ -100,7 +101,13 @@ async fn run(config: Config, db: DB, shutdown: Controller<String>) -> Result<()>
)
.await?;

spawn_in_span(shutdown.with_cancel(p2p_event_loop.run(ot_metrics.clone())));
spawn_in_span(shutdown.with_cancel(p2p_event_loop.run()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for this run, lets move it after resubscribe.

@momosh-ethernal momosh-ethernal merged commit cc61a09 into main Aug 27, 2024
1 check passed
@momosh-ethernal momosh-ethernal deleted the metric-events branch August 27, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants