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

Exposing the simulation results through public functions in sim-lib #197

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

bjohnson5
Copy link
Collaborator

Closes Issue #196. Adds public functions to sim-lib that let a library user get the current simulation statistics.

@carlaKC carlaKC self-requested a review August 13, 2024 18:13
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

lgtm, one nit

@@ -770,7 +781,7 @@ impl Simulation {
}
});

let result_logger = Arc::new(Mutex::new(PaymentResultLogger::new()));
let result_logger = self.results.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need both let result_logger = self.results.clone(); and let result_logger_clone = result_logger.clone(); below? Seems like we could reduce to a single clone?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm. I think you need a results logger in the run_results_logger spawned task and the consume_simulation_results spawned task as well as the main simulation thread. So the Arc should have a reference count of 3? Which means you need to clone it twice. Am I understanding that correctly? Very possible I am missing something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope you're totally right - missed consume_simulation_results below!

@carlaKC carlaKC merged commit 31ef59e into bitcoin-dev-project:main Aug 21, 2024
2 checks passed
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.

2 participants