Page MenuHomeSoftware Heritage

Don't store empty metadata dicts.
ClosedPublic

Authored by vlorentz on Apr 3 2019, 11:27 AM.

Diff Detail

Repository
rDCIDX Object indexer
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Apr 3 2019, 11:27 AM
olasd added a subscriber: olasd.Apr 3 2019, 3:56 PM
olasd added inline comments.
swh/indexer/metadata.py
308–309

This can be rewritten as if ref_item['metadata'].keys() <= {'@context'}

312–320

Couldn't we turn these into sets rather than doing O(n^2) equality lookups? (I'm guessing n is tiny and it doesn't really matter, but still :p)

vlorentz added inline comments.Apr 3 2019, 4:11 PM
swh/indexer/metadata.py
308–309

TIL

312–320

No, they contain unhashable data, and n is too small to do something clever.

vlorentz updated this revision to Diff 4284.Apr 3 2019, 4:12 PM

Apply @olasd's comment

swh/indexer/metadata.py
308–309

(though I still have to check for Noneness)

douardda accepted this revision.Apr 15 2019, 4:48 PM
douardda added a subscriber: douardda.

LGTM but I'm not very familiar with this code.

This revision is now accepted and ready to land.Apr 15 2019, 4:48 PM
vlorentz updated this revision to Diff 4656.Apr 24 2019, 3:30 PM
  • rebase
This revision was landed with ongoing or failed builds.Apr 24 2019, 3:30 PM
This revision was automatically updated to reflect the committed changes.