MCPcopy Create free account
hub / github.com/block/buzz / handleEvent

Method handleEvent

desktop/src/shared/api/relayClientSession.ts:790–811  ·  view source on GitHub ↗
(subId: string, event: RelayEvent)

Source from the content-addressed store, hash-verified

788 }
789
790 private handleEvent(subId: string, event: RelayEvent) {
791 const subscription = this.subscriptions.get(subId);
792 if (!subscription) {
793 return;
794 }
795
796 if (subscription.mode === "history") {
797 subscription.events.push(event);
798 return;
799 }
800
801 subscription.lastSeenCreatedAt = Math.max(
802 subscription.lastSeenCreatedAt ?? 0,
803 event.created_at,
804 );
805
806 this.eventBuffer.push({ subId, event });
807 this.flushTimeout ??= window.setTimeout(
808 () => this.flushEventBuffer(),
809 EVENT_BATCH_MS,
810 );
811 }
812
813 private flushEventBuffer() {
814 this.flushTimeout = null;

Callers 1

handleWsMessageMethod · 0.95

Calls 3

flushEventBufferMethod · 0.95
pushMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected