payloadcms / payloadcms/payload
Payload with getPayloadHMR don't close or spams db connections during Static Site Generation
@denolfe is already working on this.
Since Jul 23, 2024.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Link to reproduction
No response
Payload Version
3.0.0-beta.68
Node Version
v20.11.1
Next.js Version
next@15.0.0-rc.0
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?
Reproduction Steps
When I will have time maybe I will try to create an example repo, but rough reproduction:
- Get a postgress db - set max_connection to 100 or less.
- Create a bunch of pages
- Try generate with
next build
Adapters and Plugins
db-postgres
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.