Skip to content

Payload with getPayloadHMR don't close or spams db connections during Static Site Generation #7312

Open
@Dovchik

Description

@Dovchik

Link to reproduction

No response

Payload Version

3.0.0-beta.68

Node Version

v20.11.1

Next.js Version

[email protected]

Describe the Bug

I'm using postgres 12, and static generation with getStatisProps combined with local api of getPayloadHMR
Having 32 statically generated pages I encounter a problem that the last few pages are not generated right away, worker for generation terminates and restarts, finishing page generation. On second screenshot you can see a peak of postgres connections - max 100 for my system - in idle state, after peak drops, that's when workers are terminated, restarted and finished. This works after some optimizations I've made, because before that, SSG were failing with too many clients from postgres.
Is this an intended behavior and I should scale connections as count of my pages growth or that's going something wrong with how connections are managed in local api?
image
image

Reproduction Steps

When I will have time maybe I will try to create an example repo, but rough reproduction:

  1. Get a postgress db - set max_connection to 100 or less.
  2. Create a bunch of pages
  3. Try generate with next build

Adapters and Plugins

db-postgres

Metadata

Metadata

Labels

keepPrevents from being marked stale or auto-closed.status: cant-reproduceIf an issue cannot be reproduced

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions