File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ pub struct Tap {
231231 default_value_t = 1_000_000_000 // 1 second
232232 ) ]
233233 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 ,
234242
235243 // TODO: Remove this whenever the the gateway registry is ready
236244 #[ clap(
Original file line number Diff line number Diff line change 11// Copyright 2023-, GraphOps and Semiotic Labs.
22// SPDX-License-Identifier: Apache-2.0
33
4- use std:: { collections:: HashMap , sync:: Arc } ;
4+ use std:: { collections:: HashMap , sync:: Arc , time :: Duration } ;
55
66use alloy_primitives:: Address ;
77use alloy_sol_types:: Eip712Domain ;
@@ -295,9 +295,12 @@ impl SenderAllocationRelationship {
295295 . await ?;
296296
297297 // 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 ) ?;
299303
300- // TODO: Add a timeout.
301304 let response: JsonRpcResponse < EIP712SignedMessage < ReceiptAggregateVoucher > > = client
302305 . request (
303306 "aggregate_receipts" ,
@@ -440,6 +443,7 @@ mod tests {
440443 tap : config:: Tap {
441444 rav_request_trigger_value : 100 ,
442445 rav_request_timestamp_buffer_ns : 1000 ,
446+ rav_request_timeout_secs : 5 ,
443447 ..Default :: default ( )
444448 } ,
445449 ..Default :: default ( )
You can’t perform that action at this time.
0 commit comments