Commit 9a8802a
authored
fix(datastore): handle commit failures gracefully instead of panicking (#572)
* fix(datastore): handle commit failures gracefully instead of panicking
When a transaction commit fails (e.g. disk full / SQLITE_FULL), the
worker thread panicked, permanently breaking the datastore channel.
All subsequent requests returned MpscError (HTTP 500) until restart.
Replace the panic with error logging and continue. The rolled-back
events will be re-sent by watchers via heartbeat or retried by clients.
Add CommitFailed error variant mapped to HTTP 503 (Service Unavailable)
so clients know to back off and retry.
Fixes #256
* fix(datastore): apply graceful error handling to legacy import commit
The main work loop commit (line 193) was already handled gracefully
(error log + continue), but the legacy import commit (line 143) still
panicked on failure. This makes the error handling consistent.
Addresses review feedback from Greptile.
* docs(datastore): correct misleading comment about event recovery on commit failure
* refactor(datastore): remove unused CommitFailed error variant1 parent 5747056 commit 9a8802a
1 file changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
195 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
196 | 211 | | |
197 | 212 | | |
198 | 213 | | |
| |||
0 commit comments