wunderfrucht / gouqi

a rust interface for jira
https://crates.io/crates/gouqi
MIT License
26 stars 8 forks source link

Async support #28

Open willbuckner opened 1 year ago

willbuckner commented 1 year ago

Having this library block makes it a bit frustrating to work with from within an async actix_web API. Sure, we can use it inside a web::block(), but currently even the builder code can't run in an async context, making dependency injection a bit tricky. Given that we're already using reqwest to interact with Jira, I think it wouldn't be too hard to interact with Jira asynchronously.

I'm not sure whether others have use cases that depend on blocking code, but if so, we could have both a Jira and an AsyncJira (perhaps gated by a crate feature). I wanted to get some feedback on the high level approach before possibly sending a PR--would having both an async client and a blocking client be preferred, or would you be open to making the entire library asynchronous and leaving it up to callers to provide a runtime (or are neither acceptable)? Thanks!

avrabe commented 1 year ago

I liked the approach from zbus moving from synchronous to asynchronous. They moved the library to asynchronous and introduced a blocking wrapper for the synchronous use case.

This should enable us to move to asynchronous while having minimal impact to synchronous implementations.