Commit 43e8543
committed
fix: handle fast-completion race in StreamBatchItemsService count check
When all batch runs complete before getBatchEnqueuedCount() is called,
cleanup() has already deleted the enqueuedItemsKey in Redis, causing it
to return 0. The existing Postgres fallback only checked sealed, but the
BatchQueue completion path sets status=COMPLETED without setting
sealed=true. Add the status check so the endpoint returns sealed:true
instead of triggering SDK retries into a dead BatchQueue.
Also switch findUnique to findFirst per webapp convention.1 parent 7d7ebdd commit 43e8543
1 file changed
Lines changed: 8 additions & 5 deletions
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
223 | | - | |
| 226 | + | |
224 | 227 | | |
225 | 228 | | |
226 | 229 | | |
| |||
0 commit comments