@@ -12,8 +12,7 @@ const INTERNAL_SERVER_PORT = process.env.INTERNAL_SERVER_PORT
1212 : 5051 ;
1313const RIVET_NAMESPACE = process . env . RIVET_NAMESPACE ?? "default" ;
1414const RIVET_RUNNER_NAME = process . env . RIVET_RUNNER_NAME ?? "test-runner" ;
15- const RIVET_RUNNER_KEY =
16- process . env . RIVET_RUNNER_KEY ;
15+ const RIVET_RUNNER_KEY = process . env . RIVET_RUNNER_KEY ;
1716const RIVET_RUNNER_VERSION = process . env . RIVET_RUNNER_VERSION
1817 ? Number ( process . env . RIVET_RUNNER_VERSION )
1918 : 1 ;
@@ -106,8 +105,7 @@ if (AUTOSTART_SERVER) {
106105
107106if ( AUTOSTART_RUNNER ) {
108107 [ runner , runnerStarted , runnerStopped ] = await startRunner ( ) ;
109- }
110- else await autoConfigureServerless ( ) ;
108+ } else await autoConfigureServerless ( ) ;
111109
112110async function autoConfigureServerless ( ) {
113111 const res = await fetch (
@@ -155,13 +153,14 @@ async function startRunner(): Promise<
155153 token : RIVET_TOKEN ,
156154 namespace : RIVET_NAMESPACE ,
157155 runnerName : RIVET_RUNNER_NAME ,
158- runnerKey : RIVET_RUNNER_KEY ?? `key-${ Math . floor ( Math . random ( ) * 10000 ) } ` ,
156+ runnerKey :
157+ RIVET_RUNNER_KEY ?? `key-${ Math . floor ( Math . random ( ) * 10000 ) } ` ,
159158 totalSlots : RIVET_RUNNER_TOTAL_SLOTS ,
160159 prepopulateActorNames : { } ,
161160 onConnected : ( ) => {
162161 runnerStarted . resolve ( undefined ) ;
163162 } ,
164- onDisconnected : ( ) => { } ,
163+ onDisconnected : ( ) => { } ,
165164 onShutdown : ( ) => {
166165 runnerStopped . resolve ( undefined ) ;
167166 } ,
@@ -227,9 +226,17 @@ async function startRunner(): Promise<
227226 ws . send ( `Echo: ${ data } ` ) ;
228227
229228 // Ack
230- const websocketId = Buffer . from ( ( event as any ) . rivetRequestId ) . toString ( "base64" ) ;
231- websocketLastMsgIndexes . set ( websocketId , ( event as any ) . rivetMessageIndex ) ;
232- runner . sendWebsocketMessageAck ( ( event as any ) . rivetRequestId , ( event as any ) . rivetMessageIndex ) ;
229+ const websocketId = Buffer . from (
230+ ( event as any ) . rivetRequestId ,
231+ ) . toString ( "base64" ) ;
232+ websocketLastMsgIndexes . set (
233+ websocketId ,
234+ ( event as any ) . rivetMessageIndex ,
235+ ) ;
236+ runner . sendWebsocketMessageAck (
237+ ( event as any ) . rivetRequestId ,
238+ ( event as any ) . rivetMessageIndex ,
239+ ) ;
233240 } ) ;
234241
235242 ws . addEventListener ( "close" , ( ) => {
0 commit comments