-
Notifications
You must be signed in to change notification settings - Fork 20
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
Is new Worker(module { ... },)
a bad idea?
#43
Labels
host environment
Questions to be answered in each host environment
Comments
For reference to future readers, the workaround I showed is #21 (comment). |
nicolo-ribaudo
added
the
host environment
Questions to be answered in each host environment
label
Oct 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I understand @domenic correctly, he is concerned that making the Worker constructor accept a Module Block removes too much friction from creating Workers and creates a risk of developers creating one-off workers for single tasks which would be counter-productive for performance.
Here’s how I plan to address that concern:
Making the worker constructor (and worklet constructors!) accept module blocks is a core feature of this proposal. It is one of the most frequently cited issues around Workers and Worklets. Without this, I don’t think there is a point in moving forward with this proposal (unless we want to encourage workarounds like @nicolo-ribaudo showed).
Workers are currently barely used at all (apart from ReCAPTCHA driving up the usage stats), so I don’t share the concern that people will start spam-creating workers. The Blink worker team and the scheduler team don’t have strong opinions on this, either.
That being said, in the long-term, developers being irresponsible with Worker creation is worth thinking about. If we want to mitigate worker abuse, however, it should not just address worker abuse done via Module Blocks. There are libraries (like Greenlet) that make it ergonomic and easy to spam-create workers today, without module blocks. Any mitigations we come up with should cover those patterns as well.
@domenic have I captured your concern accurately? If not, where am I misunderstanding you? If yes, can you help me understand why my proposed solution is insufficient? Considering that I believe that allowing people spin up workers without a separate file is essential, can we find a way forward here?
The text was updated successfully, but these errors were encountered: