Skip to content

Commit b63977a

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 0c657ef commit b63977a

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
@@ -46,7 +46,6 @@ type CustomRetryPolicy = FilteredRetryPolicy<
4646
// We set this to a small number of threads that would still allow to make some progress if one
4747
// would hit a blocking case
4848
const INTERNAL_RUNTIME_WORKERS: usize = 2;
49-
const VSS_IO_TIMEOUT: Duration = Duration::from_secs(5);
5049

5150
/// A [`KVStoreSync`] implementation that writes to and reads from a [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
5251
pub struct VssStore {
@@ -129,16 +128,7 @@ impl KVStoreSync for VssStore {
129128
let inner = Arc::clone(&self.inner);
130129
let fut =
131130
async move { inner.read_internal(primary_namespace, secondary_namespace, key).await };
132-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
133-
// times out.
134-
tokio::task::block_in_place(move || {
135-
internal_runtime.block_on(async move {
136-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
137-
let msg = "VssStore::read timed out";
138-
Error::new(ErrorKind::Other, msg)
139-
})
140-
})?
141-
})
131+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
142132
}
143133

144134
fn write(
@@ -168,16 +158,7 @@ impl KVStoreSync for VssStore {
168158
)
169159
.await
170160
};
171-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
172-
// times out.
173-
tokio::task::block_in_place(move || {
174-
internal_runtime.block_on(async move {
175-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
176-
let msg = "VssStore::write timed out";
177-
Error::new(ErrorKind::Other, msg)
178-
})
179-
})?
180-
})
161+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
181162
}
182163

183164
fn remove(
@@ -206,16 +187,7 @@ impl KVStoreSync for VssStore {
206187
)
207188
.await
208189
};
209-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
210-
// times out.
211-
tokio::task::block_in_place(move || {
212-
internal_runtime.block_on(async move {
213-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
214-
let msg = "VssStore::remove timed out";
215-
Error::new(ErrorKind::Other, msg)
216-
})
217-
})?
218-
})
190+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
219191
}
220192

221193
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -228,16 +200,7 @@ impl KVStoreSync for VssStore {
228200
let secondary_namespace = secondary_namespace.to_string();
229201
let inner = Arc::clone(&self.inner);
230202
let fut = async move { inner.list_internal(primary_namespace, secondary_namespace).await };
231-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
232-
// times out.
233-
tokio::task::block_in_place(move || {
234-
internal_runtime.block_on(async move {
235-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
236-
let msg = "VssStore::list timed out";
237-
Error::new(ErrorKind::Other, msg)
238-
})
239-
})?
240-
})
203+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
241204
}
242205
}
243206

0 commit comments

Comments
 (0)