-
Notifications
You must be signed in to change notification settings - Fork 418
Allow async events processing without holding total_consistency_lock
#2199
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -342,7 +342,8 @@ macro_rules! define_run_body { | |
// falling back to our usual hourly prunes. This avoids short-lived clients never | ||
// pruning their network graph. We run once 60 seconds after startup before | ||
// continuing our normal cadence. | ||
if $timer_elapsed(&mut last_prune_call, if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER }) { | ||
let prune_timer = if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER }; | ||
if $timer_elapsed(&mut last_prune_call, prune_timer) { | ||
// The network graph must not be pruned while rapid sync completion is pending | ||
if let Some(network_graph) = $gossip_sync.prunable_network_graph() { | ||
#[cfg(feature = "std")] { | ||
|
@@ -360,7 +361,8 @@ macro_rules! define_run_body { | |
|
||
have_pruned = true; | ||
} | ||
last_prune_call = $get_timer(NETWORK_PRUNE_TIMER); | ||
let prune_timer = if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER }; | ||
last_prune_call = $get_timer(prune_timer); | ||
} | ||
|
||
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) { | ||
|
@@ -867,7 +869,10 @@ mod tests { | |
|
||
if key == "network_graph" { | ||
if let Some(sender) = &self.graph_persistence_notifier { | ||
sender.send(()).unwrap(); | ||
match sender.send(()) { | ||
Ok(()) => {}, | ||
Err(std::sync::mpsc::SendError(())) => println!("Persister failed to notify as receiver went away."), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we're shutting the other task down after the first send. However, we also persist again on shutdown, which triggers a second send, which would panic as the receiver is already gone at that point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a comment for why this is ok would be helpful |
||
} | ||
}; | ||
|
||
if let Some((error, message)) = self.graph_error { | ||
|
Uh oh!
There was an error while loading. Please reload this page.