From: Scott Worley Date: Tue, 10 Oct 2023 09:09:19 +0000 (-0700) Subject: client: Explain the exponential re-send delay X-Git-Tag: v0.1.0~25 X-Git-Url: http://git.scottworley.com/tattlekey/commitdiff_plain/24ed36185962a76e99aef7cded338c1fd16e8e6b?ds=inline client: Explain the exponential re-send delay --- diff --git a/client/config.c b/client/config.c index 83a3eb3..d3006c7 100644 --- a/client/config.c +++ b/client/config.c @@ -22,7 +22,29 @@ const uint config_button_pin = 18; * times in short succession. (We also use this to de-bounce. :) */ const u32_t config_minimum_seconds_between_button_presses = 1; -/* Send each report multiple times. */ +/* Send each report multiple times. Re-sends are sent with exponential delay: + * #1 sent immediately + * #2 after 1 seconds + * #3 after 2 seconds + * #4 after 4 seconds + * #5 after 8 seconds + * ... + * #11 after 8 minutes + * #12 after 17 minutes + * #13 after 34 minutes + * #14 after 68 minutes + * #15 after 2 hours + * #16 after 4 hours + * #17 after 9 hours + * etc. + * This provides some robustness against network outages, automatically + * replaying the log periodically to be collected after connectivity + * is restored. + * + * Values above 17 are currently not recommended because the current + * wire format uses a 16-bit field for a duration in seconds, which wraps + * at 18 hours. + * */ const uint config_resend_count = 5; /* These control the size of the per-send-count press queues. diff --git a/client/config.h b/client/config.h index 2ffce68..8d23169 100644 --- a/client/config.h +++ b/client/config.h @@ -42,7 +42,29 @@ extern const uint config_button_pin; * times in short succession. (We also use this to de-bounce. :) */ extern const u32_t config_minimum_seconds_between_button_presses; -/* Send each report multiple times. */ +/* Send each report multiple times. Re-sends are sent with exponential delay: + * #1 sent immediately + * #2 after 1 seconds + * #3 after 2 seconds + * #4 after 4 seconds + * #5 after 8 seconds + * ... + * #11 after 8 minutes + * #12 after 17 minutes + * #13 after 34 minutes + * #14 after 68 minutes + * #15 after 2 hours + * #16 after 4 hours + * #17 after 9 hours + * etc. + * This provides some robustness against network outages, automatically + * replaying the log periodically to be collected after connectivity + * is restored. + * + * Values above 17 are currently not recommended because the current + * wire format uses a 16-bit field for a duration in seconds, which wraps + * at 18 hours. + * */ extern const uint config_resend_count; /* These control the size of the per-send-count press queues.