-
Notifications
You must be signed in to change notification settings - Fork 13
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
Implement HttpBlock #262
Implement HttpBlock #262
Conversation
bcd7695
to
2ec1c2a
Compare
@drslebedev I finished the tests rewrite using the scheduler. There were again some emscripten peculiarities (for some reason, the pre.js mechanism was not compatible with the setup of starting and stopping the server in each unit test), but everything should work now. If the CI agrees, from my side this should be ready for review again.
I tried that, but except for the graph connections there is no boilerplate to be saved: The sink has to be accessible from within the test, so we cannot just encapsulate it in a |
@vimpostor Could you please squash the commits into a single commit or possibly two? Given the presence of some work-in-progress commits, consolidating them will contribute to a cleaner commit history. |
7085331
to
49dd4d2
Compare
Squashed it into two commits. |
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.
Thanks!
Can be merged.
This helps with writing unit tests.
49dd4d2
to
0e9988e
Compare
This block can use both message ports as well as a public member function as a trigger to make requests to a HTTP API (e.g. REST API) and will return the response on its output ports. Fixes #236
0e9988e
to
9032f65
Compare
This implements the
HttpBlock
as described in #236.The WebAssembly implementation took quite some jumping through hoops to get right.
There are a lot of quirks with regard to threading in emscripten, that make the implementation a minefield of risking getting stuck in infinite loops, because the emscripten thread for various reasons is unable to make any progress.
Unfortunately we cannot use
ASYNCIFY
, because that is incompatible with exceptions support (that are already enabled).There is also this fun emscripten regression, which means it's currently impossible to cancel asynchronously running fetch requests.
For the unit test the httplib dummy server obviously doesn't work with emscripten, so the --pre-js mechanism is used to implement another one with node http, that is automatically injected into the runtime.
Note that in order for the unit test to run,
node
needs to be able to findxhr2
, so: