Skip to content

fix(runtime): close Worker database pools per request - #846

Merged
tiankaima merged 1 commit into
mainfrom
agent/fix-worker-prisma-lifecycle
Aug 14, 2026
Merged

fix(runtime): close Worker database pools per request#846
tiankaima merged 1 commit into
mainfrom
agent/fix-worker-prisma-lifecycle

Conversation

@tiankaima

Copy link
Copy Markdown
Member

Summary

  • run request-scoped cleanup before a Cloudflare runtime callback resolves
  • disconnect app, auth, and maintenance Prisma clients at the end of each Worker request
  • preserve concurrent-request isolation and callback errors during cleanup

Production evidence

Before this change, sequential requests consistently showed the second request hanging:

  • /api/auth/get-session: 200 (0.82s) -> timeout (10s) -> 200 (1.36s)
  • repeated ChatGPT CIMD authorization: 302 (1.82s) -> timeout (15s)

Validation

  • Biome check
  • 22 focused unit tests
  • application, test, and operational TypeScript checks
  • wrangler types --check
  • production build

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
life-ustc 6da9193 Aug 14 2026, 05:26 PM

@tiankaima
tiankaima force-pushed the agent/fix-worker-prisma-lifecycle branch from 3fc9bca to df8c863 Compare August 14, 2026 17:06
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

@tiankaima
tiankaima force-pushed the agent/fix-worker-prisma-lifecycle branch from df8c863 to 6da9193 Compare August 14, 2026 17:25
@tiankaima
tiankaima merged commit 2675d10 into main Aug 14, 2026
17 checks passed
@tiankaima
tiankaima deleted the agent/fix-worker-prisma-lifecycle branch August 14, 2026 17:40
github-actions Bot pushed a commit that referenced this pull request Aug 14, 2026
## [1.90.5](v1.90.4...v1.90.5) (2026-08-14)

### Bug Fixes

* **runtime:** close Worker database pools per request ([#846](#846)) ([2675d10](2675d10))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.90.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant