diff --git a/.changeset/evil-carrots-grab.md b/.changeset/evil-carrots-grab.md new file mode 100644 index 00000000..684882fd --- /dev/null +++ b/.changeset/evil-carrots-grab.md @@ -0,0 +1,5 @@ +--- +"partyserver": patch +--- + +remove redundant initialize code as setName takes care of it, along with the nested blockConcurrencyWhile call diff --git a/packages/partyserver/src/index.ts b/packages/partyserver/src/index.ts index 75048bdb..a0d1d008 100644 --- a/packages/partyserver/src/index.ts +++ b/packages/partyserver/src/index.ts @@ -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); } @@ -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); } @@ -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); } @@ -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(); } }