Commit f43713e
fix: Handle closed DuckDB connections gracefully in pool cleanup
When a query fails and closes the connection, the pool cleanup was
trying to execute SELECT 1 on the closed connection, causing
"Connection already closed!" errors on subsequent queries.
Now if a connection is invalid during cleanup, we:
1. Close it properly
2. Create a fresh connection
3. Return the fresh connection to the pool
This ensures the pool always contains valid connections and prevents
cascading connection errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 3215070 commit f43713e
1 file changed
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
161 | 164 | | |
162 | | - | |
163 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
164 | 172 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
168 | 176 | | |
169 | 177 | | |
170 | 178 | | |
| |||
0 commit comments