mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Revert "docs: fix bug in transaction example (#3414)"
This reverts commit dcb4257898d1d8d37110a4364922206dad33f9fe. The change doesn’t fix the bug it claims to (`finally` always runs) and introduces a resource leak if the `ROLLBACK` query fails. The related bug that a broken client can be returned to the pool remains unaffected either way.
This commit is contained in:
parent
a5d03a0774
commit
a9fd34fb42
@ -31,10 +31,10 @@ try {
|
||||
const insertPhotoValues = [res.rows[0].id, 's3.bucket.foo']
|
||||
await client.query(insertPhotoText, insertPhotoValues)
|
||||
await client.query('COMMIT')
|
||||
client.release()
|
||||
} catch (e) {
|
||||
await client.query('ROLLBACK')
|
||||
client.release()
|
||||
throw e
|
||||
} finally {
|
||||
client.release()
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user