feat(readers): same-code debounce at the dispatcher, per-reader window (default 5000 ms)
Build & push images / images (push) Successful in 3m7s
Build & push images / images (push) Successful in 3m7s
park-2, 2026-10-11: the DT-008 entry reader reported one card twice 560 ms
apart; the permit flow opened two sessions on the same permit and pulsed the
barrier twice (caught by the new relay-pulse log). The 24h before showed
2 entry + 2 exit opens within 2 s of the previous one.
ReadDispatcher now treats the same value from the same reader inside the
reader's debounceMs window as ONE presentation: the first verdict is replayed
(same beep, no second decision, nothing signed twice) and the repeat lands in
device_events as unsigned telemetry. Every lane and every credential kind,
so a ticket re-scanned at exit inside its grace period no longer signs a
noSession refusal for a car that just left. The window slides with repeats;
a repeat arriving while the first read is still deciding gets that decision.
The window is a Setup field on all three reader drivers ("Same-code
debounce (ms)", default 5000, 0 = off); readers configured before the field
existed get the default.
This commit is contained in:
@@ -8,7 +8,7 @@ import type {
|
||||
ReaderDevice,
|
||||
ReaderEvent,
|
||||
} from "../interfaces.js";
|
||||
import type { DeviceConfig, DiscoverableDriver, DiscoveredDevice, ReaderDriver } from "../registry.js";
|
||||
import type { ConfigField, DeviceConfig, DiscoverableDriver, DiscoveredDevice, ReaderDriver } from "../registry.js";
|
||||
import { hostField, portField, stubLog } from "./common.js";
|
||||
import {
|
||||
QR_CARD_INPUT_FORMATS,
|
||||
@@ -72,6 +72,20 @@ class StubReader implements ReaderDevice {
|
||||
}
|
||||
}
|
||||
|
||||
/** Same-code debounce, applied HOST-SIDE by the read dispatcher (apps/server read-dispatch.ts)
|
||||
* to every reader regardless of lane or credential kind: the same value from the same reader
|
||||
* within this window is ONE presentation — the first verdict is replayed (same beep), nothing
|
||||
* is signed twice. Born 2026-10-11 at park-2: the DT-008 reported one card twice 560 ms apart
|
||||
* and the permit flow opened two sessions and pulsed the barrier twice. 0 disables. */
|
||||
export const debounceField: ConfigField = {
|
||||
key: "debounceMs",
|
||||
label: "Same-code debounce (ms)",
|
||||
type: "number",
|
||||
required: false,
|
||||
default: 5000,
|
||||
help: "A repeat of the same card/QR/ticket on this reader within this window counts as the same presentation (first verdict replayed, no second entry/exit). 0 = off.",
|
||||
};
|
||||
|
||||
export const wiegandReaderDriver: ReaderDriver = {
|
||||
id: "wiegand-reader",
|
||||
category: "reader",
|
||||
@@ -85,6 +99,7 @@ export const wiegandReaderDriver: ReaderDriver = {
|
||||
{ value: "26", label: "Wiegand 26" },
|
||||
{ value: "34", label: "Wiegand 34" },
|
||||
] },
|
||||
debounceField,
|
||||
],
|
||||
create: (c) => new StubReader("wiegand-reader", c),
|
||||
};
|
||||
@@ -96,7 +111,7 @@ export const tcpipReaderDriver: ReaderDriver = {
|
||||
description:
|
||||
"Network RF/optical reader seen only by the host; host decides and commands the relay.",
|
||||
transports: ["tcp-ip"],
|
||||
configFields: [hostField, portField(9000)],
|
||||
configFields: [hostField, portField(9000), debounceField],
|
||||
create: (c) => new StubReader("tcpip-reader", c),
|
||||
};
|
||||
|
||||
@@ -297,6 +312,7 @@ export const dingtianQrReaderDriver: ReaderDriver & DiscoverableDriver = {
|
||||
required: false,
|
||||
help: "The reader's IP on the device VLAN. With it, save sets the reader to HTTP mode pointing at this booth and the monitor pings it. Blank = configure the reader manually; no liveness.",
|
||||
},
|
||||
debounceField,
|
||||
],
|
||||
discover: discoverDingtianReaders,
|
||||
create: (c) => new DingtianQrReader("dingtian-qr-reader", c),
|
||||
|
||||
Reference in New Issue
Block a user