Commit 1d2f53c
committed
Fix Worker hang: use per-request connections instead of cached pool
The module-level cached mysql2 pool could hold stale connections when
the Worker isolate went idle, causing the next request to hang forever.
Switch from createPool (cached) to createConnection (per-request) with
proper cleanup via connection.end() in a finally block. Hyperdrive
handles actual connection pooling at the edge, so mysql2 pooling is
unnecessary and harmful. Also adds connectTimeout: 5000 as a safety net.
https://claude.ai/code/session_01K4SCzhd53zgSyEEoNPF59B1 parent cdda6ee commit 1d2f53c
1 file changed
Lines changed: 17 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 8 | | |
30 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
31 | 25 | | |
0 commit comments