go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5k stars 328 forks source link

Add PagePool.MustGet, modify Get method allow error return rather recover panic. #1049

Closed zeoxisca closed 2 months ago

zeoxisca commented 2 months ago

PagePool

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, 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.

By the way, PagePool.CleanUp may stuck while pp is not full. I also think this might be an issue when using PagePool.