Skip to content

Commit af25208

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 bc5e4a9 commit af25208

File tree

1 file changed

+4
-40
lines changed

1 file changed

+4
-40
lines changed

src/io/vss_store.rs

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,7 @@ impl KVStoreSync for VssStore {
118118
let inner = Arc::clone(&self.inner);
119119
let fut =
120120
async move { inner.read_internal(primary_namespace, secondary_namespace, key).await };
121-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
122-
// times out.
123-
tokio::task::block_in_place(move || {
124-
internal_runtime.block_on(async move {
125-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
126-
let msg = "VssStore::read timed out";
127-
Error::new(ErrorKind::Other, msg)
128-
})
129-
})?
130-
})
121+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
131122
}
132123

133124
fn write(
@@ -157,16 +148,7 @@ impl KVStoreSync for VssStore {
157148
)
158149
.await
159150
};
160-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
161-
// times out.
162-
tokio::task::block_in_place(move || {
163-
internal_runtime.block_on(async move {
164-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
165-
let msg = "VssStore::write timed out";
166-
Error::new(ErrorKind::Other, msg)
167-
})
168-
})?
169-
})
151+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
170152
}
171153

172154
fn remove(
@@ -195,16 +177,7 @@ impl KVStoreSync for VssStore {
195177
)
196178
.await
197179
};
198-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
199-
// times out.
200-
tokio::task::block_in_place(move || {
201-
internal_runtime.block_on(async move {
202-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
203-
let msg = "VssStore::remove timed out";
204-
Error::new(ErrorKind::Other, msg)
205-
})
206-
})?
207-
})
180+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
208181
}
209182

210183
fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> {
@@ -217,16 +190,7 @@ impl KVStoreSync for VssStore {
217190
let secondary_namespace = secondary_namespace.to_string();
218191
let inner = Arc::clone(&self.inner);
219192
let fut = async move { inner.list_internal(primary_namespace, secondary_namespace).await };
220-
// TODO: We could drop the timeout here once we ensured vss-client's Retry logic always
221-
// times out.
222-
tokio::task::block_in_place(move || {
223-
internal_runtime.block_on(async move {
224-
tokio::time::timeout(VSS_IO_TIMEOUT, fut).await.map_err(|_| {
225-
let msg = "VssStore::list timed out";
226-
Error::new(ErrorKind::Other, msg)
227-
})
228-
})?
229-
})
193+
tokio::task::block_in_place(move || internal_runtime.block_on(fut))
230194
}
231195
}
232196

0 commit comments

Comments
 (0)