Page MenuHomeSoftware Heritage

Explicitely give Db connections back to the pool.
ClosedPublic

Authored by vlorentz on Apr 9 2019, 4:56 PM.

Details

Summary

So they gracefully release the connection on error instead
of relying on reference-counting to call the Db's __del__
(which does not happen in Hypothesis tests) because a ref
to it is kept via the traceback object.

See also: D1381

Diff Detail

Repository
rDCORE Foundations and core functionalities
Branch
put_conn
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5246
Build 7097: tox-on-jenkinsJenkins
Build 7096: arc lint + arc unit

Event Timeline

olasd added a subscriber: olasd.
olasd added inline comments.
swh/core/db/common.py
51

Can we guard this with an if hasattr(self, 'put_db') to avoid making other users of this (indexer, archiver) insta-buggy?

84

Same comment

This revision is now accepted and ready to land.Apr 9 2019, 5:33 PM
swh/core/db/common.py
51

No, because I removed BaseDb.__del__, so it would leak connections in prod.

This revision was automatically updated to reflect the committed changes.