-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstatus-quo-story-ideas"Status quo" user story ideas"Status quo" user story ideas
Description
- Brief summary:
- Hacking on a simple client that has to make api calls but where performance isn't much of a priority; many of the libraries are written in an async style, but sometimes you want to make those calls in a location where you can't conveniently make the code async (e.g., an iterator).
- Currently trying to manage this situation involves either propagating
asynceverywhere or addingblock_oncalls. But, at least in tokio,block_oncalls cannot execute from async threads, so this can lead to panics if that code that is usingblock_onever winds up in an async context.
- Character: Barbara, this was sourced from a conversation with @Mark-Simulacrum
More details from my conversation with @Mark-Simulacrum
- Context: building things like perf.rust-lang.org, triagebot
- Performance is not a real issue here, convenience and expressiveness is
- only have so much time to work on this, trying to stand something up quickly
- Want a way to make calls to various web services, connect to databases, or do other parts of I/O
- Would be happy with sync, but the libraries and things are in async
- Didn't really want to have to pick a runtime, doesn't care much, mostly wants things to Just Work. In the end picked tokio as the only widely known tool at the time, as well as the one that is compatible with things like defaults in hyper.
- Sometimes find themselves in a synchronous context but need to do an async operation
- e.g., implementing an iterator
- Don't care too much about performance, so add a
block_on- But block-on doesn't take an async block
- So often nest a spawn inside
- But then that code gets invoked in an async context, and the code panics
- Frustrating -- how bad of a problem is it really?
- Example code
- Gets in the scenario (example) where
- something internally has to be make an http request
- do we make it async?
- that forces all callers to be async
- or sync with block-on
- then cannot be used from an async context
- or just sync?
- but then need to find a different http lib (can't use reqwest/hyper)
parker-codes, archisgore, PatchMixolydic, janriemer and schneiderfelipe
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstatus-quo-story-ideas"Status quo" user story ideas"Status quo" user story ideas