@@ -235,7 +235,7 @@ pub struct Download {
235
235
pub server : DownloadServer ,
236
236
237
237
// piece_timeout is the timeout for downloading a piece from source.
238
- #[ serde( default = "default_download_piece_timeout" ) ]
238
+ #[ serde( default = "default_download_piece_timeout" , with = "humantime_serde" ) ]
239
239
pub piece_timeout : Duration ,
240
240
241
241
// concurrent_piece_count is the number of concurrent pieces to download.
@@ -301,12 +301,18 @@ pub struct Scheduler {
301
301
// announce_interval is the interval to announce peer to the scheduler.
302
302
// Announcer will provide the scheduler with peer information for scheduling,
303
303
// peer information includes cpu, memory, etc.
304
- #[ serde( default = "default_scheduler_announce_interval" ) ]
304
+ #[ serde(
305
+ default = "default_scheduler_announce_interval" ,
306
+ with = "humantime_serde"
307
+ ) ]
305
308
pub announce_interval : Duration ,
306
309
307
310
// schedule_timeout is the timeout for scheduling. If the scheduling timesout, dfdaemon will back-to-source
308
311
// download if enable_back_to_source is true, otherwise dfdaemon will return download failed.
309
- #[ serde( default = "default_scheduler_schedule_timeout" ) ]
312
+ #[ serde(
313
+ default = "default_scheduler_schedule_timeout" ,
314
+ with = "humantime_serde"
315
+ ) ]
310
316
pub schedule_timeout : Duration ,
311
317
312
318
// max_schedule_count is the max count of schedule.
@@ -381,7 +387,10 @@ pub struct SeedPeer {
381
387
pub cluster_id : u64 ,
382
388
383
389
// keepalive_interval is the interval to keep alive with manager.
384
- #[ serde( default = "default_seed_peer_keepalive_interval" ) ]
390
+ #[ serde(
391
+ default = "default_seed_peer_keepalive_interval" ,
392
+ with = "humantime_serde"
393
+ ) ]
385
394
pub keepalive_interval : Duration ,
386
395
}
387
396
@@ -402,7 +411,10 @@ impl Default for SeedPeer {
402
411
#[ serde( default , rename_all = "camelCase" ) ]
403
412
pub struct Dynconfig {
404
413
// refresh_interval is the interval to refresh dynamic configuration from manager.
405
- #[ serde( default = "default_dynconfig_refresh_interval" ) ]
414
+ #[ serde(
415
+ default = "default_dynconfig_refresh_interval" ,
416
+ with = "humantime_serde"
417
+ ) ]
406
418
pub refresh_interval : Duration ,
407
419
}
408
420
@@ -438,7 +450,11 @@ impl Default for Storage {
438
450
#[ serde( default , rename_all = "camelCase" ) ]
439
451
pub struct Policy {
440
452
// task_ttl is the ttl of the task.
441
- #[ serde( default = "default_gc_policy_task_ttl" , rename = "taskTTL" ) ]
453
+ #[ serde(
454
+ default = "default_gc_policy_task_ttl" ,
455
+ rename = "taskTTL" ,
456
+ with = "humantime_serde"
457
+ ) ]
442
458
pub task_ttl : Duration ,
443
459
444
460
// dist_high_threshold_percent is the high threshold percent of the disk usage.
@@ -470,7 +486,7 @@ impl Default for Policy {
470
486
#[ serde( default , rename_all = "camelCase" ) ]
471
487
pub struct GC {
472
488
// interval is the interval to do gc.
473
- #[ serde( default = "default_gc_interval" ) ]
489
+ #[ serde( default = "default_gc_interval" , with = "humantime_serde" ) ]
474
490
pub interval : Duration ,
475
491
476
492
// policy is the gc policy.
0 commit comments