collect db values for integrity check in chunks

This commit is contained in:
Jack Robison 2022-11-12 16:48:01 -05:00
parent 134aad29f1
commit 929448d64b

View file

@ -135,9 +135,11 @@ class RevertableOpStack:
existing = {} existing = {}
if self._enforce_integrity and unique_keys: if self._enforce_integrity and unique_keys:
unique_keys = list(unique_keys) unique_keys = list(unique_keys)
existing.update({ for idx in range(0, len(unique_keys), 10000):
k: v for k, v in zip(unique_keys, self._multi_get(unique_keys)) batch = unique_keys[idx:idx+10000]
}) existing.update({
k: v for k, v in zip(batch, self._multi_get(batch))
})
for op in ops_to_apply: for op in ops_to_apply:
if op.key in self._items and len(self._items[op.key]) and self._items[op.key][-1] == op.invert(): if op.key in self._items and len(self._items[op.key]) and self._items[op.key][-1] == op.invert():