-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Support asynchronous read-file function (asyncReadFileFn) #304
Conversation
Can you also check that async is compiled in dist/ folder to ES5 via grunt? This way you could use promises everywhere. Though you might need to update examples and docs due to a breaking changes |
|
The thing is that grunt does not compile files to es5, that means that browsers are going to crash if they do not support |
Is this ready to be merged? |
No, I'm revamping the PR because the way I checked for asynchronicity of function is not compatible with bundled code. |
e9056c4
to
9f47392
Compare
03836b4
to
468f1d4
Compare
468f1d4
to
387c8d6
Compare
xhr.restore(); | ||
}); | ||
|
||
it('synchronous initFileFn and asyncReadFileFn', async function (done) { |
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.
travis build does not pass 1 test
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 don't get why.
It's probably an error parsing the JS code of the test, but what exactly? (https://caniuse.com/?compare=firefox+60,firefox+80&compareCats=JS):
- backticks
- async
- window.crypto.subtle.digest
- Uint8Array
- TextEncoder
Still, I guess all of these are supported by FF 60...
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 tried SauceLabs locally, but get errors:
15 09 2020 12:31:46.912:INFO [launcher]: Starting browser firefox 45 (Linux) on SauceLabs
2020-09-15T15:32:43.192Z ERROR webdriver: Request failed with status 500 due to Error: Infrastructure Error -- The Sauce VMs failed to start the browser or device.
For more info, please check https://wiki.saucelabs.com/display/DOCS/Common+Error+Messages
2020-09-15T15:32:43.196Z ERROR webdriver: Error: Infrastructure Error -- The Sauce VMs failed to start the browser or device.
For more info, please check https://wiki.saucelabs.com/display/DOCS/Common+Error+Messages
at getErrorFromResponseBody (flow.js/node_modules/webdriver/build/utils.js:121:10)
at WebDriverRequest._request (/flow.js/node_modules/webdriver/build/request.js:149:56)
at process._tickCallback (internal/process/next_tick.js:68:7)
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.
Have you tried running it on the latest firefox? If it works, it might be just a quirk on saucelabs
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.
karma start karma.conf.js --browsers=sl_firefox_2
(actually modified it for FF45)
16 09 2020 11:22:33.219:DEBUG [launcher.SauceConnect]: 16 Sep 11:22:33 - Sauce Connect is up, you may start your tests.
16 09 2020 11:23:09.815:WARN [launcher]: firefox 45 (Linux) on SauceLabs have not captured in 60000 ms, killing.
16 09 2020 11:23:09.816:ERROR [SaucelabsLauncher]: Could not quit the Saucelabs selenium connection. Failure message:
16 09 2020 11:23:09.816:ERROR [SaucelabsLauncher]: TypeError: Cannot read property 'deleteSession' of null
I don't know what am I doing wrong.
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 the issue is related to karma-runner/karma-sauce-launcher#210
Could you please investigate whether SauceLabs backend is correctly configured?
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.
Doing:
SAUCE_USERNAME=flowjs SAUCE_ACCESS_KEY=53e609a9-cb5d-4eac-a888-xxx grunt karma:saucelabs
I still can't test saucelabs and can't explain why the CI fails.
I know how annoying to get an always-red CI and would prefer to avoid this.
Any hope you could take the time to double check the SauceLabs configuration? (and the travis' one?)
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.
Did you stopped the CI ?
Note: I observed problems with |
0a0e1bb
to
93f9129
Compare
this.readStreamState.resolve(); | ||
|
||
// Equivalent to readFinished() | ||
this.readState = 2; |
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.
Since we are releasing v3 version, maybe it's simpler to make some breaking changes? We can get rid off all those semaphores :))
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 agree Deferred-based locking could benefit to the rest of the codebase, but could we postpone that to a later commit/PR, otherwise this will significantly broaden the scope of the PR and make it harder to review/test/revert.
5393f12
to
2b3246c
Compare
2b3246c
to
99402d4
Compare
Added more tests about chunk size mismatch.
|
…total amount of bytes to upload. The number of chunks may also be off. Let fail safely: - if read using an async function - and the last chunk read less bytes than usual (including 0) - and the current chunk read no byte - assume that this chunk is in fact superfluous and simulate its completion. Previous discussion on: flowjs#42 flowjs#318 In the long-term Flow.js may have to support the concept of "approximate chunk number".
0ea63e7
to
86a87e7
Compare
Closing in favor of #321 |
See #295, #296 and #300