Skip to content

Commit 22973b1

Browse files
committed
fix(rivetkit): fix type errors in msgIndex tracking
1 parent d307ae6 commit 22973b1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

rivetkit-typescript/packages/rivetkit/src/drivers/engine/actor-driver.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ export class EngineActorDriver implements ActorDriver {
633633
if (hibernatableWs) {
634634
// Update msgIndex for next WebSocket open msgIndex restoration
635635
const oldMsgIndex = hibernatableWs.msgIndex;
636-
hibernatableWs.msgIndex = BigInt(event.rivetMessageIndex);
636+
hibernatableWs.msgIndex = event.rivetMessageIndex;
637637
hibernatableWs.lastSeenTimestamp = Date.now();
638638

639639
logger().debug({
@@ -743,7 +743,8 @@ export class EngineActorDriver implements ActorDriver {
743743
const actorHandler = this.#actors.get(actorId);
744744
if (actorHandler?.actor) {
745745
const hibernatableArray =
746-
actorHandler.actor[ACTOR_INSTANCE_PERSIST_SYMBOL].hibernatableConns;
746+
actorHandler.actor[ACTOR_INSTANCE_PERSIST_SYMBOL]
747+
.hibernatableConns;
747748
const wsIndex = hibernatableArray.findIndex((conn: any) =>
748749
arrayBuffersEqual(conn.hibernatableRequestId, requestIdBuf),
749750
);

rivetkit-typescript/packages/rivetkit/src/schemas/actor-persist/versioned.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const migrations = new Map<number, MigrationFn<any, any>>([
1717
...conn,
1818
hibernatableRequestId: null,
1919
})),
20-
hibernatableWebSocket: [],
20+
hibernatableWebSockets: [],
2121
}),
2222
],
2323
[
@@ -30,7 +30,7 @@ const migrations = new Map<number, MigrationFn<any, any>>([
3030
for (const conn of v2Data.connections) {
3131
if (conn.hibernatableRequestId) {
3232
// Find the matching hibernatable WebSocket
33-
const ws = v2Data.hibernatableWebSocket.find((ws) =>
33+
const ws = v2Data.hibernatableWebSockets.find((ws) =>
3434
Buffer.from(ws.requestId).equals(
3535
Buffer.from(conn.hibernatableRequestId!),
3636
),

0 commit comments

Comments
 (0)