@rivetkit/engine-runner 0.0.0-pr.4880.c7bfbc5 → 0.0.0-pr.4881.2dba543
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mod.cjs +7 -3
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.js +7 -3
- package/dist/mod.js.map +1 -1
- package/package.json +3 -3
- package/src/mod.ts +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/engine-runner",
|
|
3
|
-
"version": "0.0.0-pr.
|
|
3
|
+
"version": "0.0.0-pr.4881.2dba543",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"bench": "tsx benches/actor-lifecycle.bench.ts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@rivetkit/virtual-websocket": "0.0.0-pr.
|
|
29
|
-
"@rivetkit/engine-runner-protocol": "0.0.0-pr.
|
|
28
|
+
"@rivetkit/virtual-websocket": "0.0.0-pr.4881.2dba543",
|
|
29
|
+
"@rivetkit/engine-runner-protocol": "0.0.0-pr.4881.2dba543",
|
|
30
30
|
"uuid": "^12.0.0",
|
|
31
31
|
"pino": "^9.9.5",
|
|
32
32
|
"ws": "^8.18.3"
|
package/src/mod.ts
CHANGED
|
@@ -560,9 +560,18 @@ export class Runner {
|
|
|
560
560
|
this.#kvRequests.clear();
|
|
561
561
|
|
|
562
562
|
// Close WebSocket
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
//
|
|
564
|
+
// A CONNECTING socket cannot send graceful stopping messages, so
|
|
565
|
+
// it is always closed directly. Without this, a shutdown that
|
|
566
|
+
// races with a reconnect leaves the in-flight WebSocket alive
|
|
567
|
+
// while the rest of the runner state (tunnel, intervals) has been
|
|
568
|
+
// torn down.
|
|
569
|
+
const pegboardWebSocket = this.#pegboardWebSocket;
|
|
570
|
+
const readyState = pegboardWebSocket?.readyState;
|
|
571
|
+
const isOpen = readyState === 1;
|
|
572
|
+
const isConnecting = readyState === 0;
|
|
573
|
+
if (pegboardWebSocket && (isOpen || isConnecting)) {
|
|
574
|
+
if (immediate || isConnecting) {
|
|
566
575
|
// Stop immediately
|
|
567
576
|
pegboardWebSocket.close(1000, "pegboard.runner_shutdown");
|
|
568
577
|
} else {
|
|
@@ -874,6 +883,10 @@ export class Runner {
|
|
|
874
883
|
if (this.runnerId !== init.runnerId) {
|
|
875
884
|
this.runnerId = init.runnerId;
|
|
876
885
|
|
|
886
|
+
// Invalidate cached child logger so subsequent log
|
|
887
|
+
// lines pick up the new runnerId.
|
|
888
|
+
this.#logCached = undefined;
|
|
889
|
+
|
|
877
890
|
// Clear actors if runner id changed
|
|
878
891
|
this.#stopAllActors();
|
|
879
892
|
}
|