mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-26 14:28:01 +00:00
A field log showed 59 records buffered and not one published, with ~18 "Keepalive timeout" errors against a single successful CONNACK. Probing the broker from a fixed line ruled out the obvious causes: publishes to /packets, /rf and /regions were all PUBACKed in ~85ms with returnCode=0 and no disconnect, and a deliberate same-clientId takeover makes the victim report a bare 'close', never a keepalive error. So neither the ACL nor session contention was involved. What was: two defects that together made a flaky mobile link unrecoverable and undiagnosable. 1. drain() discarded its own progress. It collected published ids and called queue.remove ONCE after the loop, so a single rejecting publish threw and every record the broker had already acknowledged stayed queued to be sent again. Publishes are sequential, so a 59-record backlog needs ~5s of continuous link at 86ms round-trip and ~18s at 300ms - on a link that stayed up about a second at a time, the design could never commit anything at all. The loop now lives in src/drain.js with two invariants under test: a record is removed if and only if the broker acked it, and one unpublishable record can never block the records behind it. A link drop is charged to the link, not to the record, so repeated drops cannot quarantine a good reception. 2. Every Publisher ever created reported into one module-level handler writing one global brokerState, so an orphaned client's endless 4s reconnect loop overwrote a healthy connection's state and filled the log with failures nothing could attribute. Each Publisher now carries an id; events from a retired one are named once and then ignored. startPublisher no longer ADOPTS a disconnected publisher (which made connectAll print "CoreScope connected" over a looping client) - it retires it, which also stops that loop. Also: keepalive is now set explicitly and quoted in the log next to the CONNACK return code. mqtt.js arms its keepalive manager only inside _onConnect and only if one does not already exist (client.js:1101), never re-arming an existing one, so a surviving manager can report a bogus timeout on a healthy link. That error is now evidence instead of a red herring. Tests: 234 pass (+14). SW cache v36 -> v37. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
28 lines
714 B
JSON
28 lines
714 B
JSON
{
|
|
"name": "coredrive-rx",
|
|
"version": "1.11.1",
|
|
"private": false,
|
|
"license": "GPL-3.0-or-later",
|
|
"type": "module",
|
|
"description": "Mobile RX coverage capture for CoreScope: BLE companion → MQTT (GPS + SNR/RSSI + multibyte)",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/efiten/coredrive-rx.git"
|
|
},
|
|
"homepage": "https://github.com/efiten/coredrive-rx#readme",
|
|
"bugs": "https://github.com/efiten/coredrive-rx/issues",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"test": "node --test",
|
|
"deploy": "bash deploy.sh"
|
|
},
|
|
"dependencies": {
|
|
"mqtt": "^5.10.1"
|
|
},
|
|
"devDependencies": {
|
|
"vite": "^5.4.0"
|
|
}
|
|
}
|