Skip to content

Commit 52a0925

Browse files
committed
refactor: set retry config maximum delay in milliseconds
1 parent 5889a10 commit 52a0925

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ enum WordCount {
8181

8282
dictionary RetryConfig {
8383
u16 initial_retry_delay_ms;
84-
u16 maximum_delay_secs;
84+
u16 maximum_delay_ms;
8585
f32 backoff_multiplier;
8686
};
8787

src/io/tier_store.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ use std::time::Duration;
3030
// configuring.
3131
const BACKUP_QUEUE_CAPACITY: usize = 100;
3232

33-
const DEFAULT_INITIAL_RETRY_DELAY_MS: u16 = 50;
34-
const DEFAULT_MAXIMUM_RETRY_DELAY_SECS: u16 = 5;
33+
const DEFAULT_INITIAL_RETRY_DELAY_MS: u16 = 10;
34+
const DEFAULT_MAXIMUM_RETRY_DELAY_MS: u16 = 500;
3535
const DEFAULT_BACKOFF_MULTIPLIER: f32 = 1.5;
3636

3737
/// Configuration for exponential backoff retry behavior.
3838
#[derive(Debug, Copy, Clone)]
3939
pub struct RetryConfig {
4040
/// The initial delay before the first retry attempt, in milliseconds.
4141
pub initial_retry_delay_ms: u16,
42-
/// The maximum delay between retry attempts, in seconds.
43-
pub maximum_delay_secs: u16,
42+
/// The maximum delay between retry attempts, in milliseconds.
43+
pub maximum_delay_ms: u16,
4444
/// The multiplier applied to the delay after each retry attempt.
4545
///
4646
/// For example, a value of `2.0` doubles the delay after each failed retry.
@@ -51,7 +51,7 @@ impl Default for RetryConfig {
5151
fn default() -> Self {
5252
Self {
5353
initial_retry_delay_ms: DEFAULT_INITIAL_RETRY_DELAY_MS,
54-
maximum_delay_secs: DEFAULT_MAXIMUM_RETRY_DELAY_SECS,
54+
maximum_delay_ms: DEFAULT_MAXIMUM_RETRY_DELAY_MS,
5555
backoff_multiplier: DEFAULT_BACKOFF_MULTIPLIER,
5656
}
5757
}
@@ -593,7 +593,7 @@ impl TierStoreInner {
593593
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
594594
) -> io::Result<Vec<u8>> {
595595
let mut delay = Duration::from_millis(self.retry_config.initial_retry_delay_ms as u64);
596-
let maximum_delay = Duration::from_secs(self.retry_config.maximum_delay_secs as u64);
596+
let maximum_delay = Duration::from_millis(self.retry_config.maximum_delay_ms as u64);
597597
let mut tries = 0_u16;
598598

599599
loop {
@@ -653,7 +653,7 @@ impl TierStoreInner {
653653
&self, primary_namespace: &str, secondary_namespace: &str,
654654
) -> io::Result<Vec<String>> {
655655
let mut delay = Duration::from_millis(self.retry_config.initial_retry_delay_ms as u64);
656-
let maximum_delay = Duration::from_secs(self.retry_config.maximum_delay_secs as u64);
656+
let maximum_delay = Duration::from_millis(self.retry_config.maximum_delay_ms as u64);
657657
let mut tries = 0_u16;
658658

659659
loop {
@@ -703,7 +703,7 @@ impl TierStoreInner {
703703
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, buf: Vec<u8>,
704704
) -> io::Result<()> {
705705
let mut delay = Duration::from_millis(self.retry_config.initial_retry_delay_ms as u64);
706-
let maximum_delay = Duration::from_secs(self.retry_config.maximum_delay_secs as u64);
706+
let maximum_delay = Duration::from_millis(self.retry_config.maximum_delay_ms as u64);
707707
let mut tries = 0_u16;
708708

709709
loop {
@@ -767,7 +767,7 @@ impl TierStoreInner {
767767
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool,
768768
) -> io::Result<()> {
769769
let mut delay = Duration::from_millis(self.retry_config.initial_retry_delay_ms as u64);
770-
let maximum_delay = Duration::from_secs(self.retry_config.maximum_delay_secs as u64);
770+
let maximum_delay = Duration::from_millis(self.retry_config.maximum_delay_ms as u64);
771771
let mut tries = 0_u16;
772772

773773
loop {

0 commit comments

Comments
 (0)