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

randomize and add concurrency to selecting members #10

Closed

Conversation

thogiti
Copy link

@thogiti thogiti commented Jan 23, 2024

I added below items:

  1. Safe randomize using rand::thread_rng for selecting a random sample of members.
  2. Concurrent selection of members in round 1 and 2.
  3. Used tokio::sync::Mutex to share the data between threads in async.

P.S. For the folks who are beginners:

  1. Don't give up.
  2. I first tried with std::sync::Mutex and got it almost working but I struggled debug the final error where it said future cannot be sent between threads safely. Then I saw the hint in the linked article and used tokio::sync::Mutex to reimplement the solution.
  3. Did I mention, Don't give up.

Copy link
Contributor

@mimoo mimoo left a comment

Choose a reason for hiding this comment

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

thanks for the PR! I left you some comments

src/committee/orchestrator.rs Show resolved Hide resolved
src/committee/orchestrator.rs Outdated Show resolved Hide resolved
src/committee/orchestrator.rs Outdated Show resolved Hide resolved
src/committee/orchestrator.rs Show resolved Hide resolved
src/committee/orchestrator.rs Outdated Show resolved Hide resolved
src/committee/orchestrator.rs Show resolved Hide resolved
src/committee/orchestrator.rs Show resolved Hide resolved
@mimoo
Copy link
Contributor

mimoo commented Jan 27, 2024

hey sry but in the mean time someone got to it :o (#18), but don't hesitate to submit a PR for another one :)

@mimoo mimoo closed this Jan 27, 2024
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