This repository has been archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imiric
commented
Mar 8, 2022
inancgumus
reviewed
Mar 9, 2022
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.
Here are my suggestions.
@imiric, by the way, we don't return here even though the connection is closed: func (b *Browser) initEvents() error {
...
go func() {
for {
select {
case <-cancelCtx.Done():
return
case event := <-chHandler:
...
} else if event.typ == EventConnectionClose {
...
b.browserProc.didLoseConnection()
b.cancelFn()
// LOOK HERE: it makes sense to return here
}
}
}
}() This might be a bug (even though the next iteration will catch that the context is being closed). I wanted to let you know. |
imiric
pushed a commit
that referenced
this pull request
Mar 9, 2022
imiric
pushed a commit
that referenced
this pull request
Mar 9, 2022
Resolves: - #268 (comment) - #268 (comment) - #268 (comment)
imiric
pushed a commit
that referenced
this pull request
Mar 9, 2022
As discussed here[1][2], sleep() was only used in order to test the Promise rejection scenario. Since pressing ^C currently doesn't trigger it, and we should have a Go integration test that simply cancels the context, this sleep() is not needed anymore. [1]: #268 (comment) [2]: #268 (comment)
118e9df
to
7f51f8a
Compare
This was referenced Mar 10, 2022
This was referenced Mar 10, 2022
imiric
pushed a commit
that referenced
this pull request
Mar 10, 2022
Resolves: - #268 (comment) - #268 (comment) - #268 (comment)
imiric
pushed a commit
that referenced
this pull request
Mar 10, 2022
As discussed here[1][2], sleep() was only used in order to test the Promise rejection scenario. Since pressing ^C currently doesn't trigger it, and we should have a Go integration test that simply cancels the context, this sleep() is not needed anymore. [1]: #268 (comment) [2]: #268 (comment)
2c62667
to
a0e8d14
Compare
imiric
pushed a commit
that referenced
this pull request
Mar 10, 2022
c3b0dce
to
0eb8df4
Compare
imiric
pushed a commit
that referenced
this pull request
Mar 11, 2022
0eb8df4
to
6f0dd9a
Compare
imiric
pushed a commit
that referenced
this pull request
Mar 11, 2022
6f0dd9a
to
51de7f9
Compare
13986c3
to
5ccc80e
Compare
This ensures the WS connection is cleanly closed, so that we wait for and process EventConnectionClose. It should also minimize "close 1006 (abnormal closure): unexpected EOF" errors[1] on shutdown. [1]: https://community.k6.io/t/erro-0006-unexpected-eof-error-during-run-of-example-script/3136
The k6 context-based utils were deprecated[1], and will be removed in v0.38.0[2], so this attaches VU to the context so that its helper functions can be used instead. Right now it will only be used for RegisterCallback(), but we should move all other uses of it soon (mainly GetRuntime()). [1]: grafana/k6@335d99c [2]: grafana/k6#2385
5ccc80e
to
82a601f
Compare
inancgumus
approved these changes
Mar 11, 2022
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.
Nice job.
imiric
pushed a commit
that referenced
this pull request
Mar 29, 2022
This drops all usage of context-based getter functions (removed from k6 in [1]) in favor of methods attached to the VU instance passed to the extension. We attached this VU instance to the internal context in #268 to keep a similar API, but in the future this should be refactored to avoid the use of context. [1]: grafana/k6@64f17c7
imiric
pushed a commit
that referenced
this pull request
Mar 30, 2022
This drops all usage of context-based getter functions (removed from k6 in [1]) in favor of methods attached to the VU instance passed to the extension. We attached this VU instance to the internal context in #268 to keep a similar API, but in the future this should be refactored to avoid the use of context. [1]: grafana/k6@64f17c7
Merged
imiric
referenced
this pull request
in grafana/k6-docs
Jul 11, 2022
- Add the tooltip to the emoji to descrive what it means. - If there is an issue open for the feature then link to it from the emoji. Resolves: #722 (comment)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an implementation of
Browser.on(event)
, using the recently released event loop support in k6. The only supported event isdisconnected
, so it can be used as an alternative toteardown()
.It also does a few minor fixes and refactors. See the commits for details.
Closes #95