Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/evil-carrots-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"partyserver": patch
---

remove redundant initialize code as setName takes care of it, along with the nested blockConcurrencyWhile call
20 changes: 1 addition & 19 deletions packages/partyserver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,6 @@ Did you try connecting directly to this Durable Object? Try using getServerByNam
await this.setName(connection.server);
// TODO: ^ this shouldn't be async

if (this.#status !== "started") {
// This means the server "woke up" after hibernation
// so we need to hydrate it again
await this.#initialize();
}

return this.onMessage(connection, message);
}

Expand All @@ -398,11 +392,6 @@ Did you try connecting directly to this Durable Object? Try using getServerByNam
await this.setName(connection.server);
// TODO: ^ this shouldn't be async

if (this.#status !== "started") {
// This means the server "woke up" after hibernation
// so we need to hydrate it again
await this.#initialize();
}
return this.onClose(connection, code, reason, wasClean);
}

Expand All @@ -413,11 +402,6 @@ Did you try connecting directly to this Durable Object? Try using getServerByNam
await this.setName(connection.server);
// TODO: ^ this shouldn't be async

if (this.#status !== "started") {
// This means the server "woke up" after hibernation
// so we need to hydrate it again
await this.#initialize();
}
return this.onError(connection, error);
}

Expand Down Expand Up @@ -496,9 +480,7 @@ Did you try connecting directly to this Durable Object? Try using getServerByNam
this.#_name = name;

if (this.#status !== "started") {
await this.ctx.blockConcurrencyWhile(async () => {
await this.#initialize();
});
await this.#initialize();
}
}

Expand Down