Page MenuHomeSoftware Heritage

Warn when using db_transaction/db_transaction_generator where you shouldn't.
ClosedPublic

Authored by vlorentz on Oct 22 2018, 9:27 AM.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added a subscriber: ardumont.

lgtm.

Tested and worked as entertained:

# patch the storage locally
arc patch D556
make test
# all is green

# open swh.storage.storage.py
# replace @db_transaction_generator from content_get_metadata (randomly chosen as the first one with such decorator ;)
make test
# This fails with the error mentioned for content_get_metadata (
# revert the modification

# change content_update to @db_transaction (`use db_transaction_generator for generator function`).
make test

# This fails on content_update with the error mentioned (`use db_transaction for non-generator function`)

Thanks.

This revision is now accepted and ready to land.Oct 22 2018, 10:22 AM
This revision was automatically updated to reflect the committed changes.