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

Reuse timers in sealing batch logic #6636

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

lilin-lab
Copy link

The original batchwait would cause a timer instance to be created for each round of the for loop。

@magik6k magik6k changed the title to optimize the batchwait Reuse timers in sealing batch logic Jun 30, 2021
Copy link
Contributor

@magik6k magik6k 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!

now := time.Now()

b.lk.Lock()
defer b.lk.Unlock()

if len(b.todo) == 0 {
return nil
return maxWait
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we wouldn't be resetting the timer here, but I don't think this micro-optimization is worth the added complexity

@magik6k magik6k merged commit 19a536d into filecoin-project:master Jun 30, 2021
@magik6k magik6k mentioned this pull request Jul 2, 2021
10 tasks
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