Skip to content

Commit 0898db1

Browse files
committed
chore(runner): rename webSocketId -> requestId
1 parent c322940 commit 0898db1

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

engine/sdks/typescript/runner/src/tunnel.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ export class Tunnel {
213213
actor.requests.clear();
214214

215215
// Flush acks and close all WebSockets for this actor
216-
for (const webSocketId of actor.webSockets) {
217-
const ws = this.#actorWebSockets.get(webSocketId);
216+
for (const requestIdStr of actor.webSockets) {
217+
const ws = this.#actorWebSockets.get(requestIdStr);
218218
if (ws) {
219219
ws.__closeWithRetry(1000, "Actor stopped");
220-
this.#actorWebSockets.delete(webSocketId);
220+
this.#actorWebSockets.delete(requestIdStr);
221221
}
222222
}
223223
actor.webSockets.clear();
@@ -498,7 +498,8 @@ export class Tunnel {
498498
requestId: protocol.RequestId,
499499
open: protocol.ToClientWebSocketOpen,
500500
) {
501-
const webSocketId = idToStr(requestId);
501+
const requestIdStr = idToStr(requestId);
502+
502503
// Validate actor exists
503504
const actor = this.#runner.getActor(open.actorId);
504505
if (!actor) {
@@ -543,13 +544,13 @@ export class Tunnel {
543544

544545
// Track this WebSocket for the actor
545546
if (actor) {
546-
actor.webSockets.add(webSocketId);
547+
actor.webSockets.add(requestIdStr);
547548
}
548549

549550
try {
550551
// Create WebSocket adapter
551552
const adapter = new WebSocketTunnelAdapter(
552-
webSocketId,
553+
requestIdStr,
553554
(data: ArrayBuffer | string, isBinary: boolean) => {
554555
// Send message through tunnel
555556
const dataBuffer =
@@ -578,17 +579,17 @@ export class Tunnel {
578579
});
579580

580581
// Remove from map
581-
this.#actorWebSockets.delete(webSocketId);
582+
this.#actorWebSockets.delete(requestIdStr);
582583

583584
// Clean up actor tracking
584585
if (actor) {
585-
actor.webSockets.delete(webSocketId);
586+
actor.webSockets.delete(requestIdStr);
586587
}
587588
},
588589
);
589590

590591
// Store adapter
591-
this.#actorWebSockets.set(webSocketId, adapter);
592+
this.#actorWebSockets.set(requestIdStr, adapter);
592593

593594
// Convert headers to map
594595
//
@@ -649,11 +650,11 @@ export class Tunnel {
649650
},
650651
});
651652

652-
this.#actorWebSockets.delete(webSocketId);
653+
this.#actorWebSockets.delete(requestIdStr);
653654

654655
// Clean up actor tracking
655656
if (actor) {
656-
actor.webSockets.delete(webSocketId);
657+
actor.webSockets.delete(requestIdStr);
657658
}
658659
}
659660
}
@@ -663,8 +664,8 @@ export class Tunnel {
663664
requestId: ArrayBuffer,
664665
msg: protocol.ToClientWebSocketMessage,
665666
): Promise<boolean> {
666-
const webSocketId = idToStr(requestId);
667-
const adapter = this.#actorWebSockets.get(webSocketId);
667+
const requestIdStr = idToStr(requestId);
668+
const adapter = this.#actorWebSockets.get(requestIdStr);
668669
if (adapter) {
669670
const data = msg.binary
670671
? new Uint8Array(msg.data)

0 commit comments

Comments
 (0)