Skip to content

Commit 89cd37c

Browse files
committed
Drop redundant tokio::timeouts for VSS IO
Now that we rely on `reqwest` v0.12.* retry logic as well as client-side timeouts, we can address the remaining TODOs here and simply drop the redundant `tokio::timeout`s we previously added as a safeguard to blocking tasks (even though in the worst cases we saw they never actually fired).
1 parent bcde009 commit 89cd37c

1 file changed

Lines changed: 4 additions & 41 deletions

File tree

src/io/vss_store.rs

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ enum VssSchemaVersion {
6262
// We set this to a small number of threads that would still allow to make some progress if one
6363
// would hit a blocking case
6464
const INTERNAL_RUNTIME_WORKERS: usize = 2;
65-
const VSS_IO_TIMEOUT: Duration = Duration::from_secs(5);
6665

6766
/// A [`KVStoreSync`] implementation that writes to and reads from a [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
6867
pub struct VssStore {
@@ -171,16 +170,7 @@ impl KVStoreSync for VssStore {
171170
let inner = Arc::clone(&self.inner);
172171
let fut =
173172
async move { inner.read_internal(primary_namespace, secondary_namespace, key).await };
174-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
175-
// times out.
176-
tokio::task::block_in_place(move || {
177-
internal_runtime.block_on(async move {
178-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
179-
let msg = "VssStore::read timed out";
180-
Error::new(ErrorKind::Other, msg)
181-
})
182-
})?
183-
})
173+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
184174
}
185175

186176
fn write(
@@ -210,16 +200,7 @@ impl KVStoreSync for VssStore {
210200
)
211201
.await
212202
};
213-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
214-
// times out.
215-
tokio::task::block_in_place(move || {
216-
internal_runtime.block_on(async move {
217-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
218-
let msg = "VssStore::write timed out";
219-
Error::new(ErrorKind::Other, msg)
220-
})
221-
})?
222-
})
203+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
223204
}
224205

225206
fn remove(
@@ -248,16 +229,7 @@ impl KVStoreSync for VssStore {
248229
)
249230
.await
250231
};
251-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
252-
// times out.
253-
tokio::task::block_in_place(move || {
254-
internal_runtime.block_on(async move {
255-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
256-
let msg = "VssStore::remove timed out";
257-
Error::new(ErrorKind::Other, msg)
258-
})
259-
})?
260-
})
232+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
261233
}
262234

263235
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -270,16 +242,7 @@ impl KVStoreSync for VssStore {
270242
let secondary_namespace = secondary_namespace.to_string();
271243
let inner = Arc::clone(&self.inner);
272244
let fut = async move { inner.list_internal(primary_namespace, secondary_namespace).await };
273-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
274-
// times out.
275-
tokio::task::block_in_place(move || {
276-
internal_runtime.block_on(async move {
277-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
278-
let msg = "VssStore::list timed out";
279-
Error::new(ErrorKind::Other, msg)
280-
})
281-
})?
282-
})
245+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
283246
}
284247
}
285248

0 commit comments

Comments
 (0)