bridge: a discovery request that arrives twice is answered once

A broker that mirrors another delivers every message twice, and the bridge
answered both copies of a discovery request. A request is now remembered
by its messageId for 60 s, as a directive is, and its copy is dropped with
a log line. The messageId is read from the header of the Discover
directive or from the request itself when that is the header alone.
A request without a messageId is answered every time, as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 21:16:50 +00:00
parent d12767f9a7
commit 29ee1a315e
9 changed files with 147 additions and 21 deletions

View file

@ -93,6 +93,11 @@ export declare class Dispatcher {
send(topic: string, message: object): Promise<PublishResult>;
/** defer() for an interface Amazon documents no DeferredResponse for: said once, the DeferredResponse is sent. */
noteDeferral(namespace: string): void;
/**
* true for a message that came before, within REMEMBERED_MS: a broker that mirrors another delivers each message
* twice. endpointId is "" for a message to the root, a discovery request.
*/
arrivedBefore(endpointId: string, messageId: string, now?: number): boolean;
/** The text of a message on the directive topic of endpointId. Resolves when the handlers are done. */
dispatch(endpointId: string, text: string): Promise<void>;
private route;