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

Feat: change the PagePool.Get method so that it returns an error for processing. #1050

Closed
wants to merge 3 commits into from

Conversation

zeoxisca
Copy link
Contributor

Development guide

Link

Test on local before making the PR

go run ./lib/utils/simple-check

PagePool Change

  • PagePool changes the Get method so that it returns an error for processing
  • Add MustGet to be compatible with previous Get
  • Modify CleanUp method to prevent stucking

The PagePool.Get can now only accept create func() *Page as input, so there is no way to output the error that may exist in the create func other than using a closure or using recover, and it is inconvenient for users in a multi-routine environment to perform logical processing based on the actual error that occurred.

However, I'm not sure whether this change would be in line with the original design.

PagePool.CleanUp may stuck while pp is not full. I also think this might be an issue when using PagePool. Use select to prevent stucking

@zeoxisca zeoxisca closed this Apr 30, 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.

1 participant