Postgres pool, review round 1: nested transactions, account mail after commit

P-1: a transaction begun inside another one (a hook calling the Local API
without req) no longer queues behind its caller. An AsyncLocalStorage mark set
when a transaction begins lets the inner one through at once, without a
place, but never into the last connection (a second level may take that
one). If the mark is lost, a queue that has not moved for a second admits
its newest waiter. connectionReserve: false now admits everything, as
before. Measured on Postgres 17: 9, 12 and 30 such submissions finish
(before: stuck from 9).

P-2: Payload's "forgot password" and "verify your e-mail" through
mailAdapter() go out right after their transaction commits
(mail.accountMailAfterCommit, default on). With the relay hanging,
30 resets + 30 submissions finish in about 11 s instead of 43.5 s.

P-3: Postgres tests for the "not confirmed" file result after commit, a
caller's outer transaction rolled back or committed, the relay hanging,
and the nested rows; deployment.md has the measured table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 01:19:27 +01:00
co-authored by Claude Opus 5.5
parent 32bb542e8e
commit 4efadb21d5
18 changed files with 534 additions and 107 deletions
+8
View File
@@ -468,6 +468,14 @@ export type ThemeOptions = {
export type IpalOptions = IaplOptions
export type MailOptions = {
/**
* Payload's "forgot password" and "verify your e-mail", sent through `mailAdapter()`: right AFTER the
* operation's transaction commits (still in the same request), so a slow mail server holds no database
* connection; nothing is sent when the transaction is rolled back. Default true; `false` = inside the
* transaction, as before 1.17.0. No transactions (MongoDB without a replica set, SQLite): no change.
* docs/deployment.md §4.3a.
*/
accountMailAfterCommit?: boolean
/** `false` silences the one warning per process start of a site on Microsoft Graph (deprecated, removed in 2.0). */
graphDeprecationWarning?: boolean
/** The Intecion Notifications Webservice. Default on; `false` switches it off. */