Skip to content

Commit 53532d0

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 cf84c0e commit 53532d0

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

src/io/vss_store.rs

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

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

181171
fn write(
@@ -205,16 +195,7 @@ impl KVStoreSync for VssStore {
205195
)
206196
.await
207197
};
208-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
209-
// times out.
210-
tokio::task::block_in_place(move || {
211-
internal_runtime.block_on(async move {
212-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
213-
let msg = "VssStore::write timed out";
214-
Error::new(ErrorKind::Other, msg)
215-
})
216-
})?
217-
})
198+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
218199
}
219200

220201
fn remove(
@@ -243,16 +224,7 @@ impl KVStoreSync for VssStore {
243224
)
244225
.await
245226
};
246-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
247-
// times out.
248-
tokio::task::block_in_place(move || {
249-
internal_runtime.block_on(async move {
250-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
251-
let msg = "VssStore::remove timed out";
252-
Error::new(ErrorKind::Other, msg)
253-
})
254-
})?
255-
})
227+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
256228
}
257229

258230
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -265,16 +237,7 @@ impl KVStoreSync for VssStore {
265237
let secondary_namespace = secondary_namespace.to_string();
266238
let inner = Arc::clone(&self.inner);
267239
let fut = async move { inner.list_internal(primary_namespace, secondary_namespace).await };
268-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
269-
// times out.
270-
tokio::task::block_in_place(move || {
271-
internal_runtime.block_on(async move {
272-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
273-
let msg = "VssStore::list timed out";
274-
Error::new(ErrorKind::Other, msg)
275-
})
276-
})?
277-
})
240+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
278241
}
279242
}
280243

0 commit comments

Comments
 (0)