File tree 2 files changed +15
-3
lines changed
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ pub struct Tap {
231
231
default_value_t = 1_000_000_000 // 1 second
232
232
) ]
233
233
pub rav_request_timestamp_buffer_ns : u64 ,
234
+ #[ clap(
235
+ long,
236
+ value_name = "rav-request-timeout" ,
237
+ env = "RAV_REQUEST_TIMEOUT" ,
238
+ help = "Timeout (in seconds) for RAV requests." ,
239
+ default_value_t = 5
240
+ ) ]
241
+ pub rav_request_timeout_secs : u64 ,
234
242
235
243
// TODO: Remove this whenever the the gateway registry is ready
236
244
#[ clap(
Original file line number Diff line number Diff line change 1
1
// Copyright 2023-, GraphOps and Semiotic Labs.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- use std:: { collections:: HashMap , sync:: Arc } ;
4
+ use std:: { collections:: HashMap , sync:: Arc , time :: Duration } ;
5
5
6
6
use alloy_primitives:: Address ;
7
7
use alloy_sol_types:: Eip712Domain ;
@@ -295,9 +295,12 @@ impl SenderAllocationRelationship {
295
295
. await ?;
296
296
297
297
// TODO: Request compression and response decompression. Also a fancy user agent?
298
- let client = HttpClientBuilder :: default ( ) . build ( & inner. sender_aggregator_endpoint ) ?;
298
+ let client = HttpClientBuilder :: default ( )
299
+ . request_timeout ( Duration :: from_secs (
300
+ inner. config . tap . rav_request_timeout_secs ,
301
+ ) )
302
+ . build ( & inner. sender_aggregator_endpoint ) ?;
299
303
300
- // TODO: Add a timeout.
301
304
let response: JsonRpcResponse < EIP712SignedMessage < ReceiptAggregateVoucher > > = client
302
305
. request (
303
306
"aggregate_receipts" ,
@@ -440,6 +443,7 @@ mod tests {
440
443
tap : config:: Tap {
441
444
rav_request_trigger_value : 100 ,
442
445
rav_request_timestamp_buffer_ns : 1000 ,
446
+ rav_request_timeout_secs : 5 ,
443
447
..Default :: default ( )
444
448
} ,
445
449
..Default :: default ( )
You can’t perform that action at this time.
0 commit comments