fix: v0.1.16 — fix message delivery between same-member sessions
Some checks failed
Some checks failed
excludeSenderMemberId blocked delivery to ALL peers sharing the same member_id (all sessions from one join). Replaced with excludeSenderSessionPubkey which only excludes the sender's own session — peers with different session pubkeys receive correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -492,7 +492,7 @@ export async function drainForMember(
|
||||
memberPubkey: string,
|
||||
status: PeerStatus,
|
||||
sessionPubkey?: string,
|
||||
excludeSenderMemberId?: string,
|
||||
excludeSenderSessionPubkey?: string,
|
||||
): Promise<
|
||||
Array<{
|
||||
id: string;
|
||||
@@ -534,7 +534,7 @@ export async function drainForMember(
|
||||
AND delivered_at IS NULL
|
||||
AND priority::text IN (${priorityList})
|
||||
AND (target_spec = ${memberPubkey} OR target_spec = '*'${sessionPubkey ? sql` OR target_spec = ${sessionPubkey}` : sql``})
|
||||
${excludeSenderMemberId ? sql`AND sender_member_id != ${excludeSenderMemberId}` : sql``}
|
||||
${excludeSenderSessionPubkey ? sql`AND (sender_session_pubkey IS NULL OR sender_session_pubkey != ${excludeSenderSessionPubkey})` : sql``}
|
||||
ORDER BY created_at ASC, id ASC
|
||||
FOR UPDATE SKIP LOCKED
|
||||
)
|
||||
|
||||
@@ -83,7 +83,7 @@ function sendToPeer(presenceId: string, msg: WSServerMessage): void {
|
||||
|
||||
async function maybePushQueuedMessages(
|
||||
presenceId: string,
|
||||
excludeSenderMemberId?: string,
|
||||
excludeSenderSessionPubkey?: string,
|
||||
): Promise<void> {
|
||||
const conn = connections.get(presenceId);
|
||||
if (!conn) return;
|
||||
@@ -98,7 +98,7 @@ async function maybePushQueuedMessages(
|
||||
conn.memberPubkey,
|
||||
status,
|
||||
conn.sessionPubkey ?? undefined,
|
||||
excludeSenderMemberId,
|
||||
excludeSenderSessionPubkey,
|
||||
);
|
||||
for (const m of messages) {
|
||||
const push: WSPushMessage = {
|
||||
@@ -470,7 +470,7 @@ async function handleSend(
|
||||
&& peer.memberPubkey !== msg.targetSpec
|
||||
&& peer.sessionPubkey !== msg.targetSpec)
|
||||
continue;
|
||||
void maybePushQueuedMessages(pid, conn.memberId);
|
||||
void maybePushQueuedMessages(pid, conn.sessionPubkey ?? undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user