Compare commits
2 commits
cd3cb3aeb8
...
f60d986cac
Author | SHA1 | Date | |
---|---|---|---|
f60d986cac | |||
215dc4cd13 |
3 changed files with 2 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -233,7 +233,6 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||
name = "audrey"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"bindgen",
|
||||
"bytes",
|
||||
"chrono",
|
||||
|
|
|
@ -5,7 +5,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] }
|
||||
async-channel = "2.3.1"
|
||||
bytes = "1.8.0"
|
||||
chrono = { version = "0.4.38", features = ["serde", "std"], default-features = false }
|
||||
color-thief = "0.2.2"
|
||||
|
|
|
@ -153,8 +153,7 @@ impl Client {
|
|||
&self,
|
||||
request: reqwest_middleware::RequestBuilder,
|
||||
) -> Result<ByteResponse, Error> {
|
||||
// FIXME: is an entire channel per request overkill? maybe pool them?
|
||||
let (sender, receiver) = async_channel::bounded(1);
|
||||
let (sender, receiver) = tokio::sync::oneshot::channel();
|
||||
|
||||
// let tokio take care of the request + further json parsing
|
||||
// this is because reqwest doesn't like the glib main loop
|
||||
|
@ -198,11 +197,10 @@ impl Client {
|
|||
// note that in general its fine not to cancel the tokio task when its corresponding
|
||||
// mainloop task is dropped, since eg for song thumbnails there's already a semaphore
|
||||
// limiting concurrent requests
|
||||
let _ = sender.send(perform(future.await).await).await;
|
||||
let _ = sender.send(perform(future.await).await);
|
||||
});
|
||||
|
||||
receiver
|
||||
.recv()
|
||||
.await
|
||||
.map_err(|_| Error::OtherError("failed to receive response from tokio loop"))?
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue