@@ -137,9 +137,9 @@ export class Runner {
137
137
}
138
138
139
139
#stopAllActors( ) {
140
- console . log (
141
- "Stopping all actors due to runner lost threshold exceeded" ,
142
- ) ;
140
+ // console.log(
141
+ // "Stopping all actors due to runner lost threshold exceeded",
142
+ // );
143
143
144
144
const actorIds = Array . from ( this . #actors. keys ( ) ) ;
145
145
for ( const actorId of actorIds ) {
@@ -214,7 +214,7 @@ export class Runner {
214
214
if ( this . #started) throw new Error ( "Cannot call runner.start twice" ) ;
215
215
this . #started = true ;
216
216
217
- console . log ( "[RUNNER] Starting runner" ) ;
217
+ // console.log("[RUNNER] Starting runner");
218
218
await this . #openPegboardWebSocket( ) ;
219
219
this . #openTunnel( ) ;
220
220
@@ -285,10 +285,10 @@ export class Runner {
285
285
} else {
286
286
// Wait for actors to shut down befoer stopping
287
287
try {
288
- console . log (
289
- "Sending stopping message" ,
290
- pegboardWebSocket . readyState ,
291
- ) ;
288
+ // console.log(
289
+ // "Sending stopping message",
290
+ // pegboardWebSocket.readyState,
291
+ // );
292
292
293
293
// NOTE: We don't use #sendToServer here because that function checks if the runner is
294
294
// shut down
@@ -312,23 +312,23 @@ export class Runner {
312
312
throw new Error ( "missing pegboardWebSocket" ) ;
313
313
314
314
pegboardWebSocket . addEventListener ( "close" , ( ev ) => {
315
- console . log (
316
- "Connection closed" ,
317
- ev . code ,
318
- ev . reason . toString ( ) ,
319
- ) ;
315
+ // console.log(
316
+ // "Connection closed",
317
+ // ev.code,
318
+ // ev.reason.toString(),
319
+ // );
320
320
resolve ( ) ;
321
321
} ) ;
322
322
} ) ;
323
323
324
324
// TODO: Wait for all actors to stop before closing ws
325
325
326
- console . log ( "Closing WebSocket" ) ;
326
+ // console.log("Closing WebSocket");
327
327
pegboardWebSocket . close ( 1000 , "Stopping" ) ;
328
328
329
329
await closePromise ;
330
330
331
- console . log ( "WebSocket shutdown completed" ) ;
331
+ // console.log("WebSocket shutdown completed");
332
332
} catch ( error ) {
333
333
console . error ( "Error during WebSocket shutdown:" , error ) ;
334
334
pegboardWebSocket . close ( ) ;
@@ -341,7 +341,7 @@ export class Runner {
341
341
// Close tunnel
342
342
if ( this . #tunnel) {
343
343
this . #tunnel. shutdown ( ) ;
344
- console . log ( "Tunnel shutdown completed" ) ;
344
+ // console.log("Tunnel shutdown completed");
345
345
}
346
346
347
347
if ( exit ) {
@@ -375,9 +375,9 @@ export class Runner {
375
375
376
376
#openTunnel( ) {
377
377
const url = this . pegboardRelayUrl ;
378
- console . log ( "[RUNNER] Opening tunnel to:" , url ) ;
379
- console . log ( "[RUNNER] Current runner ID:" , this . runnerId || "none" ) ;
380
- console . log ( "[RUNNER] Active actors count:" , this . #actors. size ) ;
378
+ // console.log("[RUNNER] Opening tunnel to:", url);
379
+ // console.log("[RUNNER] Current runner ID:", this.runnerId || "none");
380
+ // console.log("[RUNNER] Active actors count:", this.#actors.size);
381
381
382
382
this . #tunnel = new Tunnel ( url ) ;
383
383
this . #tunnel. setCallbacks ( {
@@ -388,7 +388,7 @@ export class Runner {
388
388
389
389
// Re-register all active actors with the new tunnel
390
390
for ( const actorId of this . #actors. keys ( ) ) {
391
- console . log ( "[RUNNER] Re-registering actor with tunnel:" , actorId ) ;
391
+ // console.log("[RUNNER] Re-registering actor with tunnel:", actorId);
392
392
this . #tunnel. registerActor ( actorId ) ;
393
393
}
394
394
}
@@ -403,10 +403,8 @@ export class Runner {
403
403
} ) as any as WebSocket ;
404
404
this . #pegboardWebSocket = ws ;
405
405
406
- console . log ( ws ) ;
407
-
408
406
ws . addEventListener ( "open" , ( ) => {
409
- console . log ( "Connected" ) ;
407
+ // console.log("Connected");
410
408
411
409
// Reset reconnect attempt counter on successful connection
412
410
this . #reconnectAttempt = 0 ;
@@ -468,7 +466,7 @@ export class Runner {
468
466
} ) ;
469
467
} else {
470
468
clearInterval ( pingLoop ) ;
471
- console . log ( "WebSocket not open, stopping ping loop" ) ;
469
+ // console.log("WebSocket not open, stopping ping loop");
472
470
}
473
471
} , pingInterval ) ;
474
472
this . #pingLoop = pingLoop ;
@@ -480,7 +478,7 @@ export class Runner {
480
478
this . #sendCommandAcknowledgment( ) ;
481
479
} else {
482
480
clearInterval ( ackLoop ) ;
483
- console . log ( "WebSocket not open, stopping ack loop" ) ;
481
+ // console.log("WebSocket not open, stopping ack loop");
484
482
}
485
483
} , ackInterval ) ;
486
484
this . #ackInterval = ackLoop ;
@@ -509,16 +507,16 @@ export class Runner {
509
507
? Number ( init . metadata . runnerLostThreshold )
510
508
: undefined ;
511
509
512
- console . log ( "Received init" , {
513
- runnerId : init . runnerId ,
514
- lastEventIdx : init . lastEventIdx ,
515
- runnerLostThreshold : this . #runnerLostThreshold,
516
- } ) ;
510
+ // console.log("Received init", {
511
+ // runnerId: init.runnerId,
512
+ // lastEventIdx: init.lastEventIdx,
513
+ // runnerLostThreshold: this.#runnerLostThreshold,
514
+ // });
517
515
518
516
// Reopen tunnel with runner ID
519
- console . log ( "[RUNNER] Received runner ID, reopening tunnel" ) ;
517
+ // console.log("[RUNNER] Received runner ID, reopening tunnel");
520
518
if ( this . #tunnel) {
521
- console . log ( "[RUNNER] Shutting down existing tunnel" ) ;
519
+ // console.log("[RUNNER] Shutting down existing tunnel");
522
520
this . #tunnel. shutdown ( ) ;
523
521
}
524
522
this . #openTunnel( ) ;
@@ -543,7 +541,7 @@ export class Runner {
543
541
} ) ;
544
542
545
543
ws . addEventListener ( "close" , ( ev ) => {
546
- console . log ( "Connection closed" , ev . code , ev . reason . toString ( ) ) ;
544
+ // console.log("Connection closed", ev.code, ev.reason.toString());
547
545
548
546
this . #config. onDisconnected ( ) ;
549
547
@@ -565,9 +563,9 @@ export class Runner {
565
563
this . #runnerLostThreshold &&
566
564
this . #runnerLostThreshold > 0
567
565
) {
568
- console . log (
569
- `Starting runner lost timeout: ${ this . #runnerLostThreshold / 1000 } s` ,
570
- ) ;
566
+ // console.log(
567
+ // `Starting runner lost timeout: ${this.#runnerLostThreshold / 1000}s`,
568
+ // );
571
569
this . #runnerLostTimeout = setTimeout ( ( ) => {
572
570
this . #stopAllActors( ) ;
573
571
} , this . #runnerLostThreshold) ;
@@ -580,12 +578,12 @@ export class Runner {
580
578
}
581
579
582
580
#handleCommands( commands : protocol . ToClientCommands ) {
583
- console . log ( "Received commands" , {
584
- commandCount : commands . length ,
585
- } ) ;
581
+ // console.log("Received commands", {
582
+ // commandCount: commands.length,
583
+ // });
586
584
587
585
for ( const commandWrapper of commands ) {
588
- console . log ( "Received command" , commandWrapper ) ;
586
+ // console.log("Received command", commandWrapper);
589
587
if ( commandWrapper . inner . tag === "CommandStartActor" ) {
590
588
this . #handleCommandStartActor( commandWrapper ) ;
591
589
} else if ( commandWrapper . inner . tag === "CommandStopActor" ) {
@@ -621,7 +619,7 @@ export class Runner {
621
619
622
620
// Register actor with tunnel
623
621
if ( this . #tunnel) {
624
- console . log ( "[RUNNER] Registering new actor with tunnel:" , actorId ) ;
622
+ // console.log("[RUNNER] Registering new actor with tunnel:", actorId);
625
623
this . #tunnel. registerActor ( actorId ) ;
626
624
} else {
627
625
console . error (
@@ -701,12 +699,12 @@ export class Runner {
701
699
timestamp : Date . now ( ) ,
702
700
} ) ;
703
701
704
- console . log (
705
- "Sending event to server" ,
706
- eventWrapper . index ,
707
- eventWrapper . inner . tag ,
708
- eventWrapper . inner . val ,
709
- ) ;
702
+ // console.log(
703
+ // "Sending event to server",
704
+ // eventWrapper.index,
705
+ // eventWrapper.inner.tag,
706
+ // eventWrapper.inner.val,
707
+ // );
710
708
711
709
this . #sendToServer( {
712
710
tag : "ToServerEvents" ,
@@ -760,12 +758,12 @@ export class Runner {
760
758
timestamp : Date . now ( ) ,
761
759
} ) ;
762
760
763
- console . log (
764
- "Sending event to server" ,
765
- eventWrapper . index ,
766
- eventWrapper . inner . tag ,
767
- eventWrapper . inner . val ,
768
- ) ;
761
+ // console.log(
762
+ // "Sending event to server",
763
+ // eventWrapper.index,
764
+ // eventWrapper.inner.tag,
765
+ // eventWrapper.inner.val,
766
+ // );
769
767
770
768
this . #sendToServer( {
771
769
tag : "ToServerEvents" ,
@@ -786,7 +784,7 @@ export class Runner {
786
784
return ;
787
785
}
788
786
789
- console . log ( "Sending command acknowledgment" , this . #lastCommandIdx) ;
787
+ // console.log("Sending command acknowledgment", this.#lastCommandIdx);
790
788
791
789
this . #sendToServer( {
792
790
tag : "ToServerAckCommands" ,
@@ -1159,7 +1157,7 @@ export class Runner {
1159
1157
}
1160
1158
1161
1159
if ( processedCount > 0 ) {
1162
- console . log ( `Processed ${ processedCount } queued KV requests` ) ;
1160
+ // console.log(`Processed ${processedCount} queued KV requests`);
1163
1161
}
1164
1162
}
1165
1163
@@ -1184,7 +1182,7 @@ export class Runner {
1184
1182
1185
1183
#scheduleReconnect( ) {
1186
1184
if ( this . #shutdown) {
1187
- console . log ( "Runner is shut down, not attempting reconnect" ) ;
1185
+ // console.log("Runner is shut down, not attempting reconnect");
1188
1186
return ;
1189
1187
}
1190
1188
@@ -1195,16 +1193,16 @@ export class Runner {
1195
1193
jitter : true ,
1196
1194
} ) ;
1197
1195
1198
- console . log (
1199
- `Scheduling reconnect attempt ${ this . #reconnectAttempt + 1 } in ${ delay } ms` ,
1200
- ) ;
1196
+ // console.log(
1197
+ // `Scheduling reconnect attempt ${this.#reconnectAttempt + 1} in ${delay}ms`,
1198
+ // );
1201
1199
1202
1200
this . #reconnectTimeout = setTimeout ( async ( ) => {
1203
1201
if ( ! this . #shutdown) {
1204
1202
this . #reconnectAttempt++ ;
1205
- console . log (
1206
- `Attempting to reconnect (attempt ${ this . #reconnectAttempt} )...` ,
1207
- ) ;
1203
+ // console.log(
1204
+ // `Attempting to reconnect (attempt ${this.#reconnectAttempt})...`,
1205
+ // );
1208
1206
await this . #openPegboardWebSocket( ) ;
1209
1207
}
1210
1208
} , delay ) ;
@@ -1217,9 +1215,9 @@ export class Runner {
1217
1215
1218
1216
if ( eventsToResend . length === 0 ) return ;
1219
1217
1220
- console . log (
1221
- `Resending ${ eventsToResend . length } unacknowledged events from index ${ Number ( lastEventIdx ) + 1 } ` ,
1222
- ) ;
1218
+ // console.log(
1219
+ // `Resending ${eventsToResend.length} unacknowledged events from index ${Number(lastEventIdx) + 1}`,
1220
+ // );
1223
1221
1224
1222
// Resend events in batches
1225
1223
const events = eventsToResend . map ( ( item ) => item . event ) ;
@@ -1241,7 +1239,7 @@ export class Runner {
1241
1239
1242
1240
const prunedCount = originalLength - this . #eventHistory. length ;
1243
1241
if ( prunedCount > 0 ) {
1244
- console . log ( `Pruned ${ prunedCount } old events from history` ) ;
1242
+ // console.log(`Pruned ${prunedCount} old events from history`);
1245
1243
}
1246
1244
}
1247
1245
@@ -1265,7 +1263,7 @@ export class Runner {
1265
1263
}
1266
1264
1267
1265
if ( toDelete . length > 0 ) {
1268
- console . log ( `Cleaned up ${ toDelete . length } expired KV requests` ) ;
1266
+ // console.log(`Cleaned up ${toDelete.length} expired KV requests`);
1269
1267
}
1270
1268
}
1271
1269
}
0 commit comments