Skip to content

Commit

Permalink
fix: prevent route loss on commit on target route
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Dec 5, 2023
1 parent cafe432 commit d17b648
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions packages/transport/stream/src/__tests__/stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe("streams", function () {
let session: TestSessionStream;
let streams: ReturnType<typeof createMetrics>[];

beforeAll(async () => {});
beforeAll(async () => { });

beforeEach(async () => {
// 0 and 2 not connected
Expand Down Expand Up @@ -501,7 +501,7 @@ describe("streams", function () {
let session: TestSessionStream;
let streams: ReturnType<typeof createMetrics>[];

beforeAll(async () => {});
beforeAll(async () => { });

beforeEach(async () => {
session = await connected(3, {
Expand Down Expand Up @@ -640,7 +640,7 @@ describe("streams", function () {
let streams: ReturnType<typeof createMetrics>[];
const data = new Uint8Array([1, 2, 3]);

beforeAll(async () => {});
beforeAll(async () => { });

beforeEach(async () => {
session = await connected(3, {
Expand Down Expand Up @@ -758,7 +758,7 @@ describe("streams", function () {
let streams: ReturnType<typeof createMetrics>[];
const data = new Uint8Array([1, 2, 3]);

beforeAll(async () => {});
beforeAll(async () => { });

beforeEach(async () => {
session = await disconnected(5, {
Expand Down Expand Up @@ -1095,7 +1095,7 @@ describe("streams", function () {
let streams: ReturnType<typeof createMetrics>[];
let timer: ReturnType<typeof setTimeout>;

beforeAll(async () => {});
beforeAll(async () => { });

beforeEach(async () => {
session = await connected(3, {
Expand Down
6 changes: 3 additions & 3 deletions packages/transport/stream/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,9 @@ export abstract class DirectStream<
): Promise<{ promise: Promise<void> }> {
const idString = toBase64(message.id);

const ppp = this._ackCallbacks.get(idString);
if (ppp) {
return { promise: ppp.promise };
const existing = this._ackCallbacks.get(idString);
if (existing) {
return { promise: existing.promise };
}

const allAckS: ACK[] = [];
Expand Down
8 changes: 4 additions & 4 deletions packages/transport/stream/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ export class Routes {
session
);
}
map.delete(target);
return;
} else {
return;
}
/* if (map.size === 1) {
this.pendingRoutes.delete(session);
return;
} */
} else {
for (const [target, routes] of map) {
for (const route of routes) {
Expand Down

0 comments on commit d17b648

Please sign in to comment.