Open tpmccallum opened 1 year ago
import concurrent
, set max_workers
in a thread pool executor and start calling etc.Also note that as of yesterday, the official wasi-http
proposal has support for concurrent outbound requests: https://github.com/WebAssembly/wasi-http/pull/3#discussion_r1116383159, so we'll want to adopt that when it's ready. It still won't reflect the long term vision for asynchronous WASI, but it will be a big step in the right direction.
At present, whilst single outbound requests are supported; neither Spin nor Cloud supports being able to run multiple concurrent outgoing requests.
This could present a limitation to a user who is planning on building their application on Spin/Cloud. The following paragraph is a little more information Re: time/resources/practicability of having multiple concurrent outgoing requests supported.
One plan is to add first-class support for structured concurrency (which is needed for concurrent outgoing requests) to the WASI Component Model and WASI Preview 3. The timeline for such a task to be completed could take at least one year.
In the meantime, if concurrent outgoing requests are a high priority, then we could potentially emulate concurrent outgoing HTTP requests using WASI Preview 1 or 2 polling (a WASI API for waiting for I/O events on multiple handles).