Files
corescope-rx/package.json
T
Erwin FitenandClaude Opus 5 22a61cdd1b fix: concurrent drains published the same records twice
A clean v1.11.1 field log drained the 59-record backlog four seconds after
connecting - then logged "published 49 record(s)" one second later, for a queue
that had held 59. 59 - 49 = 10 = COMMIT_EVERY, which pins the mechanism exactly.

drain() had no mutual exclusion and four uncoordinated callers: the 5s drainLoop,
the broker 'connect' event, the 'online' event and the "Push pending now" button.
Two overlapping passes each call queue.takeAll(), so both see and both PUBLISH the
rows the other has not committed yet. Here the second pass started just after the
first committed its opening batch of 10, found the other 49 still queued, and
delivered every one of them to the ingestor a second time.

The hole predates the incremental-commit change - the old all-or-nothing drain
could double-publish just as easily - but batching the commits is what made it
visible and measurable in a log.

serialiseDrain() now holds one in-flight pass; a caller arriving mid-pass joins it
rather than starting its own. Joining rather than queueing a follow-up is
deliberate: the second caller wants the outcome, and anything queued after the
running pass took its snapshot is picked up by the next 5s tick. The slot is
released on rejection too, so a failed pass cannot wedge every future drain.

Otherwise that log is healthy and confirms the v1.11.1 fixes: the 59 buffered
records went out in one pass, and the new instrumentation shows publisher #1 alone
with connack rc=0, no retired-publisher events and no keepalive timeouts - the
4-second reconnect loop is gone.

Tests: 237 pass (+3). SW cache v37 -> v38.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 09:39:52 +02:00

28 lines
714 B
JSON

{
"name": "coredrive-rx",
"version": "1.11.2",
"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"
}
}