@@ -13,7 +13,6 @@ use std::panic::RefUnwindSafe;
1313use std:: pin:: Pin ;
1414use std:: sync:: atomic:: { AtomicU64 , AtomicUsize , Ordering } ;
1515use std:: sync:: { Arc , Mutex } ;
16- use std:: time:: Duration ;
1716
1817use bitcoin:: hashes:: { sha256, Hash , HashEngine , Hmac , HmacEngine } ;
1918use lightning:: io:: { self , Error , ErrorKind } ;
@@ -35,7 +34,6 @@ use crate::io::utils::check_namespace_key_validity;
3534// We set this to a small number of threads that would still allow to make some progress if one
3635// would hit a blocking case
3736const INTERNAL_RUNTIME_WORKERS : usize = 2 ;
38- const VSS_IO_TIMEOUT : Duration = Duration :: from_secs ( 5 ) ;
3937
4038/// A [`KVStoreSync`] implementation that writes to and reads from a [VSS](https://github.com/lightningdevkit/vss-server/blob/main/README.md) backend.
4139pub struct VssStore {
@@ -118,16 +116,7 @@ impl KVStoreSync for VssStore {
118116 let inner = Arc :: clone ( & self . inner ) ;
119117 let fut =
120118 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- } )
119+ tokio:: task:: block_in_place ( move || internal_runtime. block_on ( fut) )
131120 }
132121
133122 fn write (
@@ -157,16 +146,7 @@ impl KVStoreSync for VssStore {
157146 )
158147 . await
159148 } ;
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- } )
149+ tokio:: task:: block_in_place ( move || internal_runtime. block_on ( fut) )
170150 }
171151
172152 fn remove (
@@ -195,16 +175,7 @@ impl KVStoreSync for VssStore {
195175 )
196176 . await
197177 } ;
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- } )
178+ tokio:: task:: block_in_place ( move || internal_runtime. block_on ( fut) )
208179 }
209180
210181 fn list ( & self , primary_namespace : & str , secondary_namespace : & str ) -> io:: Result < Vec < String > > {
@@ -217,16 +188,7 @@ impl KVStoreSync for VssStore {
217188 let secondary_namespace = secondary_namespace. to_string ( ) ;
218189 let inner = Arc :: clone ( & self . inner ) ;
219190 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- } )
191+ tokio:: task:: block_in_place ( move || internal_runtime. block_on ( fut) )
230192 }
231193}
232194
0 commit comments