@@ -176,6 +176,9 @@ pub enum MirrorSubCmd {
176
176
/// Also set fastest as mirror
177
177
#[ arg( long, help = fl!( "clap-mirror-speedtest-set-fastest-help" ) ) ]
178
178
set_fastest : bool ,
179
+ /// Network timeout in seconds (default: 120)
180
+ #[ arg( long, default_value = "120" , help = fl!( "clap-mirror-speedtest-timeout-help" ) ) ]
181
+ timeout : f64 ,
179
182
/// Do not refresh topics manifest.json file
180
183
#[ arg( long, help = fl!( "clap-no-refresh-topics-help" ) ) ]
181
184
no_refresh_topics : bool ,
@@ -223,13 +226,15 @@ impl CliExecuter for CliMirror {
223
226
#[ cfg( feature = "aosc" ) ]
224
227
no_refresh_topics,
225
228
no_refresh,
229
+ timeout,
226
230
} => speedtest (
227
231
no_progress,
228
232
set_fastest,
229
233
!no_refresh_topics && !config. no_refresh_topics ( ) ,
230
234
download_threads. unwrap_or_else ( || config. network_thread ( ) ) ,
231
235
no_refresh,
232
236
apt_options,
237
+ timeout,
233
238
) ,
234
239
MirrorSubCmd :: Add {
235
240
names,
@@ -461,6 +466,7 @@ pub fn speedtest(
461
466
network_threads : usize ,
462
467
no_refresh : bool ,
463
468
apt_options : Vec < String > ,
469
+ timeout : f64 ,
464
470
) -> Result < i32 , OutputError > {
465
471
if set_fastest {
466
472
root ( ) ?;
@@ -483,10 +489,9 @@ pub fn speedtest(
483
489
} else {
484
490
None
485
491
} ;
486
-
487
492
let client = blocking:: ClientBuilder :: new ( )
488
493
. user_agent ( APP_USER_AGENT )
489
- . timeout ( Duration :: from_secs ( 120 ) )
494
+ . timeout ( Duration :: from_secs_f64 ( timeout ) )
490
495
. build ( ) ?;
491
496
492
497
let mut score_map = HashMap :: with_hasher ( ahash:: RandomState :: new ( ) ) ;
0 commit comments