Xuanwo / reqsign

Signing HTTP requests without heavy SDKs.
https://docs.rs/reqsign/
Apache License 2.0
94 stars 36 forks source link

bug: blocking IO in async contexts #476

Open twuebi opened 2 months ago

twuebi commented 2 months ago

Currently, there exist a number of functions used in async contexts that perform blocking IO. This can cause hard to debug issues (https://ryhl.io/blog/async-what-is-blocking/). An initial proposal which replaced std::fs calls on non-wasm targets by tokio::fs calls was done in #458 but rejected as it would have meant not being generic over async runtimes.

Xuanwo commented 4 weeks ago

Should be fixed by our new Context design: https://github.com/Xuanwo/reqsign/blob/d38265a670676847cbd1c4be908a7a2550b4d031/crates/reqsign/src/context.rs#L8-L13

twuebi commented 3 weeks ago

Nice!

Browsing a bit, I found some std::fs calls in other places, e.g. https://github.com/Xuanwo/reqsign/blob/52e2b7e0eb5f5c64fe68b746e8b2408f8524fefe/services/google/src/credential.rs#L214

Xuanwo commented 3 weeks ago

Nice!

Browsing a bit, I found some std::fs calls in other places, e.g. https://github.com/Xuanwo/reqsign/blob/52e2b7e0eb5f5c64fe68b746e8b2408f8524fefe/services/google/src/credential.rs#L214

Yep, still working on migrating all usages.