make pushOutgoingSyncMessage return true even if no callback passed

This commit is contained in:
fryorcraken 2025-10-01 16:40:22 +10:00
parent ed30485eac
commit 0da73e4c8f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 6 additions and 4 deletions

View File

@ -647,11 +647,12 @@ describe("MessageChannel", function () {
});
// And be sends a sync message
await channelB.pushOutgoingSyncMessage(async (message) => {
const res = await channelB.pushOutgoingSyncMessage(async (message) => {
await receiveMessage(channelA, message);
return true;
});
expect(res).to.be.true;
expect(messageAcked).to.be.true;
});
});
@ -1122,7 +1123,8 @@ describe("MessageChannel", function () {
});
it("should not be added to outgoing buffer, bloom filter, or local log", async () => {
await channelA.pushOutgoingSyncMessage();
const res = await channelA.pushOutgoingSyncMessage();
expect(res).to.be.true;
const outgoingBuffer = channelA["outgoingBuffer"] as Message[];
expect(outgoingBuffer.length).to.equal(0);

View File

@ -408,8 +408,8 @@ export class MessageChannel extends TypedEventEmitter<MessageChannelEvents> {
throw error;
}
}
// Why returning false if no callback is set?
return false;
// No problem encountered so returning true
return true;
}
private _pushIncomingMessage(message: Message): void {