-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix bug causing worker-initiated messages to be broadcast to every map instance #3133
Conversation
@jfirebaugh This should fix it. Confirmed it with a quick check using jsfiddle example linked in the issue. |
send: function (type, data, callback, buffers) { | ||
this.actor.send(type, data, callback, buffers, mapId); | ||
}.bind(this) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like we're fighting our own architecture with this fake Actor
. Can you think of a way to refactor & simplify? Worker
and Actor
are so tightly coupled it might make sense to merge them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think merging Worker and Actor is probably beyond the scope of this bug fix, but I certainly agree your broader point over in #3034.
I was trying to keep the scope of this change as limited as possible, but maybe one way to simplify this a bit would be to replace WorkerSource's (and WorkerTile#parse's) actor: Actor
parameter with just a send: (type, data, callback)=>void
parameter.
Another issue with #2952 is that it can leak WebWorker Can you add a fix for that to this PR as well? |
Another issue: the blob URLs that webworkify creates aren't revoked; if you repeatedly create and remove maps, so that the worker pool is drained and refilled, they leak. |
I think this predates 2952, but yep I can add a fix for this. |
Ah, actually it probably doesn't predate 2952, since it's probably a pretty safe assumption that, before the worker pool, the |
4c2ab4b
to
cb2d45d
Compare
@jfirebaugh included fixes to dispose of event listeners and revoke object URLs. @lucaswoj also tried to clarify the code in |
cb2d45d
to
80b2925
Compare
This is ready to 🚢. We need to fix this bug before the next release. I'm also keen on simplifying our worker architecture in a follow-up. |
Closes #3086