mirror of
https://github.com/jhuebert/MeshCore.git
synced 2026-12-02 02:18:36 +00:00
feat: lower fleet !ack reply window default to 15 s
The 60 s default made every !ack test cycle a long wait, and most fleets are a handful of nodes. Drop the default to 15 s and document a sizing rule of thumb (~5 s per repeater, never below ~15 s) so operators widen it deliberately as the fleet grows. - FLEET_REPLY_WINDOW_MS 60000 -> 15000 (FleetConfig.h) - FLEET.md: storm-control sizing guidance, command/limits tables, default - test_fleet: default reply-window assertion
This commit is contained in:
1 parent
878d883710
commit
39f0f88fd6
4 files changed
+18
-10
No files matched your search
@@ -233,12 +233,16 @@ Protocol guarantees, by construction:
|
||||
(unscoped otherwise).
|
||||
|
||||
**Storm control:** the reply is scheduled at a uniform-random instant in a
|
||||
jitter window (default 60 s, node-tunable via `fleet reply <secs>`, 1–600 s)
|
||||
measured from when the script *finishes running*. With N nodes in window W and
|
||||
~1 s packets, W = 60 s keeps a 10-node fleet essentially collision-free;
|
||||
**widen W for denser fleets**. Pending replies (2 slots) are RAM-only: a
|
||||
reboot wipes them, so a re-sent `!ack` job after a reboot re-runs *and*
|
||||
re-replies. A full reply store drops and counts the reply (`refused`); no
|
||||
jitter window (default 15 s, node-tunable via `fleet reply <secs>`, 1–600 s)
|
||||
measured from when the script *finishes running*. A reply storm is N
|
||||
near-simultaneous packets that all flood and are relayed, so the window has to
|
||||
be wide enough to spread them out: **rule of thumb ≈ 5 s per repeater**. A
|
||||
3-node fleet is fine at the default; a 10-node fleet wants ~50 s and a
|
||||
20-node fleet ~100 s. Widening costs only latency, while a
|
||||
too-narrow window costs collisions — when in doubt, widen. Set it per node, or
|
||||
fleet-wide from a script (`fleet reply 50`). Pending replies (2 slots) are
|
||||
RAM-only: a reboot wipes them, so a re-sent `!ack` job after a reboot re-runs
|
||||
*and* re-replies. A full reply store drops and counts the reply (`refused`); no
|
||||
reply cooldown in v1 — per-key dedupe already bounds each script to one reply.
|
||||
|
||||
## Inline pauses (`!delay <ms>`)
|
||||
@@ -335,7 +339,7 @@ All commands begin with `fleet`.
|
||||
| `fleet tag del <tag>` | `OK - tag xiao deleted` / `Err - tag xiao not set` |
|
||||
| `fleet tag list` | `tags: xiao siteA` or `tags: (none) - broadcast scripts only` |
|
||||
| `fleet tag clear` | `OK - tags cleared` |
|
||||
| `fleet reply [<secs>]` | Query or set the `!ack` jitter window (1–600 s; default 60) |
|
||||
| `fleet reply [<secs>]` | Query or set the `!ack` jitter window (1–600 s; default 15) |
|
||||
| `fleet seen` | How many job keys are remembered: `seen 2/32` |
|
||||
| `fleet seen <key>` | `OK - key <key> seen` / `Err - key <key> not seen` — did this job run here? |
|
||||
| `fleet forget <key>` | `OK - key forgotten` — re-arm one job for a deliberate re-run |
|
||||
@@ -592,6 +596,7 @@ so it can't be orphaned from a fleet cutover by its own battery state.
|
||||
| Pending scripts | 2 — a third before the queue drains is refused, but **not** marked seen; a re-send reaches it |
|
||||
| Armed `!at` scripts | 2 (RAM-only; a reboot wipes them) |
|
||||
| Pending acknowledgements | 2 (RAM-only; a full store drops and counts) |
|
||||
| `!ack` reply window | 1–600 s; default 15 s (~5 s per repeater) |
|
||||
| Seen job keys | last 32 per boot (RAM-only; a 33rd evicts the oldest and re-arms it) |
|
||||
| `!id` key | 1–32 chars of `[A-Za-z0-9._-]` |
|
||||
| Tags | up to 8 on a repeater; up to 8 per `!tags` list; 1–16 chars each |
|
||||
|
||||
@@ -71,7 +71,10 @@
|
||||
// --- acknowledgements ---
|
||||
|
||||
#ifndef FLEET_REPLY_WINDOW_MS
|
||||
#define FLEET_REPLY_WINDOW_MS 60000UL // !ack reply jitter window (default)
|
||||
#define FLEET_REPLY_WINDOW_MS 15000UL // !ack reply jitter window (default):
|
||||
// sized for a small fleet; widen with
|
||||
// `fleet reply <secs>` as the fleet grows
|
||||
// (rule of thumb: ~5 s per repeater)
|
||||
#endif
|
||||
|
||||
#ifndef FLEET_REPLY_WINDOW_MAX_MS
|
||||
|
||||
@@ -84,7 +84,7 @@ class FleetManager {
|
||||
// valid only when psk_len > 0
|
||||
char tags[FLEET_MAX_TAGS][FLEET_TAG_LEN + 1];
|
||||
int tag_count;
|
||||
uint32_t reply_window_ms; // !ack reply jitter window (default 60 s)
|
||||
uint32_t reply_window_ms; // !ack reply jitter window (default 15 s)
|
||||
CliScriptRunner runner; // script queue + seen ring + counters
|
||||
|
||||
// armed !at scripts (RAM-only, FLEET_SCHED_STORE entries): a reboot forgets
|
||||
|
||||
@@ -1284,7 +1284,7 @@ TEST_F(FleetHooksTest, TagCommands) {
|
||||
}
|
||||
|
||||
TEST_F(FleetHooksTest, ReplyWindowCommands) {
|
||||
EXPECT_EQ(cli(fleet, "reply"), "reply window 60s");
|
||||
EXPECT_EQ(cli(fleet, "reply"), "reply window 15s");
|
||||
EXPECT_EQ(cli(fleet, "reply 90"), "OK - reply window 90s");
|
||||
EXPECT_EQ(fleet.getReplyWindowMs(), (uint32_t)90000);
|
||||
EXPECT_EQ(cli(fleet, "reply"), "reply window 90s");
|
||||
|
||||
Reference in new issue
Block a user