-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Small js refactor #2373
Small js refactor #2373
Conversation
5c60e21
to
56b3486
Compare
There really isn't a reason why it should use the context - if the context is done the whole runtime is interrupted so it won't even get to that code
56b3486
to
8e9ecd0
Compare
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.
Great 😍
Few comments
ctxPtr := new(context.Context) | ||
|
||
func (b *Bundle) Instantiate( | ||
logger logrus.FieldLogger, vuID uint64, vuImpl *moduleVUImpl, |
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.
logger logrus.FieldLogger, vuID uint64, vuImpl *moduleVUImpl, | |
logger logrus.FieldLogger, vuID uint64, vuImpl *moduleVUImpl, |
Could now we have vuID
as part of vuImpl
?
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.
probably in another PR see #2373 (comment)
// Instantiate the bundle into a new VM using a bound init context. This uses a context with a | ||
// runtime, but no state, to allow module-provided types to function within the init context. | ||
rt := goja.New() | ||
init := newBoundInitContext(b.BaseInitContext, ctxPtr, rt) | ||
if err := b.instantiate(logger, rt, init, vuID); err != nil { | ||
vuImpl.runtime = goja.New() |
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.
Could we now directly inject a vuImpl with an initialized runtime so we can maintain the initialization in one central place? (e.g. runner.newVU
)
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.
in a followign PR :P There are in practice a lot more changes, I just really needed moduleVUImpl to be part of VU and everything else was gravy
Please review commit by commit.
The idea(s) of this PR are to move away from common.Bind usage and to facilitate some changes I need for #2228 without making that PR huge