Postgres: many requests at once no longer stop the site
Each Payload transaction holds a pool connection; code inside it that runs without its req needs a second one (Payload's own forgotPassword, the mail adapter's settings read and status write, payload.kv). With the default pool of 10, ten form submissions or ten "forgot password" requests at once held every connection and waited for good. - connectionReserve (default on): at most pool size − reserve transactions open at once; a waiter older than a second may use all but the last connection. Building blocks in modules/database/transactions.ts. - Form e-mails go out right after the submission's transaction commits, in the same request (forms.emailsInTransaction: true = the old way). - recordIntegrationStatus merges identical writes and does not hold its caller while the pool is busy. - SMTP time-outs: 10 s connect, 30 s greeting, 60 s silence (smtp.timeouts). Tests on Postgres 17: 30 submissions, 30 forgot-password, and both against an SMTP server that never answers, finish while a page answers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
acfcf72c03
commit
32bb542e8e
@@ -24,6 +24,7 @@ import { formSubmitState, handleFormSubmit } from '../src/modules/forms/attachme
|
||||
import { submitForm } from '../src/modules/forms/submitForm.js'
|
||||
import { iapl } from '../src/plugin.js'
|
||||
import { buildTestConfig } from './helpers.js'
|
||||
import { testDatabase } from './http/db.js'
|
||||
|
||||
vi.mock('server-only', () => ({}))
|
||||
|
||||
@@ -127,7 +128,9 @@ beforeAll(async () => {
|
||||
{ slug: 'users', auth: true, fields: [] },
|
||||
{ slug: 'media', fields: [], upload: { staticDir: mediaDir } },
|
||||
],
|
||||
db: sqliteAdapter({ client: { url: 'file::memory:' }, push: true }),
|
||||
// SQLite in memory by default; IPAL_TEST_POSTGRES_URI / IPAL_TEST_MONGO_URI run the same tests there (on
|
||||
// Postgres the e-mails go out after the submission's transaction commits: forms.emailsInTransaction).
|
||||
db: testDatabase('formfiles'),
|
||||
editor: lexicalEditor(),
|
||||
email: recordingMail,
|
||||
plugins: [
|
||||
|
||||
Reference in New Issue
Block a user