You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening an issue to discuss about how to refactor the Worker and NodeMainInstance class to reuse code.
My current plan is to create a base class NodeInstance and try to strip out common code in WorkerData/Worker as well as NodeMainInstance in there, and then make Worker and NodeMainInstance inherit from NodeInstance.
This is useful in adding support for startup snapshots in workers and ContextifyContext - otherwise we need to repeat e.g. snapshot availability detection code in multiple places which can be tricky to maintain.
I realized that we cannot actually deserialize the default context from the snapshot if the user uses the sandbox argument of vm.createContext, since the context would be different from the one we have for our own Node.js instances. We could still do this for contexts created without the sandbox argument and the users can work around the limitation by setting up the sandbox though property setters after the call to vm.createContext, though.
Opening an issue to discuss about how to refactor the
Worker
andNodeMainInstance
class to reuse code.My current plan is to create a base class
NodeInstance
and try to strip out common code inWorkerData
/Worker
as well asNodeMainInstance
in there, and then makeWorker
andNodeMainInstance
inherit fromNodeInstance
.This is useful in adding support for startup snapshots in workers and ContextifyContext - otherwise we need to repeat e.g. snapshot availability detection code in multiple places which can be tricky to maintain.
Refs: #29842
The text was updated successfully, but these errors were encountered: