Skip to content

Drop verbose log entries in BP when no network graph is provided #1866

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

If no network graph is provided to the BackgroundProcessor, we log every time the processor loop goes around (at least every 100ms, if not more) which fille up logs with useless indications that we have no network graph.

@TheBlueMatt TheBlueMatt added this to the 0.0.113 milestone Nov 21, 2022
wpaulino
wpaulino previously approved these changes Nov 21, 2022
tnull
tnull previously approved these changes Nov 22, 2022
@TheBlueMatt
Copy link
Collaborator Author

Oops, there was a test that was relying on these logs:

$ git diff-tree -U1 969613df f6cd2f4b
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index 4201fc9ed..8aae70395 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -1072,6 +1072,7 @@ mod tests {
 			let log_entries = nodes[0].logger.lines.lock().unwrap();
-			let expected_log_a = "Assessing prunability of network graph".to_string();
-			let expected_log_b = "Not pruning network graph, either due to pending rapid gossip sync or absence of a prunable graph.".to_string();
-			if log_entries.get(&("lightning_background_processor".to_string(), expected_log_a)).is_some() &&
-				log_entries.get(&("lightning_background_processor".to_string(), expected_log_b)).is_some() {
+			let loop_counter = "Calling ChannelManager's timer_tick_occurred".to_string();
+			if log_entries
+				.get(&("lightning_background_processor".to_string(), loop_counter)).unwrap_or(0) > 1
+			{
+				// Wait until the loop has gone around at least twice.
 				break
$

If no network graph is provided to the `BackgroundProcessor`, we
log every time the processor loop goes around (at least every
100ms, if not more) which fille up logs with useless indications
that we have no network graph.
@TheBlueMatt
Copy link
Collaborator Author

Oops, the one time rustc doesn't add the neccessary references to make it compile...

$ git diff-tree -U1 f6cd2f4b 46333aff
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index 8aae70395..4970c6920 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -1073,4 +1073,4 @@ mod tests {
 			let loop_counter = "Calling ChannelManager's timer_tick_occurred".to_string();
-			if log_entries
-				.get(&("lightning_background_processor".to_string(), loop_counter)).unwrap_or(0) > 1
+			if *log_entries.get(&("lightning_background_processor".to_string(), loop_counter))
+				.unwrap_or(&0) > 1
 			{

@valentinewallace valentinewallace merged commit 17e1403 into lightningdevkit:main Nov 22, 2022
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