Commit e57d51b
committed
Discard abandoned pipelines when a bulk command fails (#628)
PhpRedis and Relay put the connection itself into pipeline mode, so a
pipeline that is never executed leaves the connection answering every
subsequent command with the client object instead of a value. The cache
then fatals while cloning that object in add_to_internal_cache(), fatals
in array_combine() on get_multiple(), and reports false from set() and
delete() even though the writes reach Redis.
The discard() calls sat in the count mismatch branches, which are only
reachable after exec() already closed the pipeline, so they never ran
when it mattered. Move them to the catch blocks, where the pipeline is
still open.
Predis needs no cleanup here, since its pipeline is a standalone object
rather than a connection mode, but its exceptions all extend Exception
and discard() on a Predis pipeline is harmless.1 parent 7264384 commit e57d51b
1 file changed
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1250 | 1250 | | |
1251 | 1251 | | |
1252 | 1252 | | |
1253 | | - | |
1254 | | - | |
1255 | 1253 | | |
1256 | 1254 | | |
1257 | 1255 | | |
| |||
1268 | 1266 | | |
1269 | 1267 | | |
1270 | 1268 | | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1271 | 1273 | | |
1272 | 1274 | | |
1273 | 1275 | | |
| |||
1501 | 1503 | | |
1502 | 1504 | | |
1503 | 1505 | | |
1504 | | - | |
1505 | | - | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
1509 | 1509 | | |
1510 | 1510 | | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1511 | 1515 | | |
1512 | 1516 | | |
1513 | 1517 | | |
| |||
2287 | 2291 | | |
2288 | 2292 | | |
2289 | 2293 | | |
2290 | | - | |
2291 | | - | |
2292 | 2294 | | |
2293 | 2295 | | |
2294 | 2296 | | |
| |||
2300 | 2302 | | |
2301 | 2303 | | |
2302 | 2304 | | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2303 | 2309 | | |
2304 | 2310 | | |
2305 | 2311 | | |
| |||
0 commit comments