Merge pull request #1229 from jakedt/capitaloops
Fixes for content checksum and torrent pieces backfill
This commit is contained in:
commit
4d9bfef08f
3 changed files with 6 additions and 7 deletions
3
app.py
3
app.py
|
@ -106,9 +106,6 @@ class InjectingFilter(logging.Filter):
|
|||
|
||||
root_logger = logging.getLogger()
|
||||
|
||||
# Add a null handler to the root logger to silence missing handler errors in tests
|
||||
root_logger.addHandler(logging.NullHandler())
|
||||
|
||||
# Add the request id filter to all handlers of the root logger
|
||||
for handler in root_logger.handlers:
|
||||
handler.addFilter(InjectingFilter())
|
||||
|
|
|
@ -132,13 +132,15 @@ def yield_random_entries(batch_query, primary_key_field, batch_size, max_id):
|
|||
try:
|
||||
while True:
|
||||
start_index = allocator.get_block_start_index(batch_size)
|
||||
end_index = min(start_index + batch_size, max_id + 1)
|
||||
all_candidates = list(batch_query()
|
||||
.where(primary_key_field >= start_index,
|
||||
primary_key_field <= start_index + batch_size))
|
||||
primary_key_field < end_index)
|
||||
.order_by(primary_key_field))
|
||||
|
||||
if len(all_candidates) == 0:
|
||||
logger.info('No candidates, new highest id: %s', start_index)
|
||||
allocator.mark_completed(start_index, max_id + 1)
|
||||
logger.info('No candidates, marking entire block completed %s-%s', start_index, end_index)
|
||||
allocator.mark_completed(start_index, end_index)
|
||||
continue
|
||||
|
||||
logger.info('Found %s candidates, processing block', len(all_candidates))
|
||||
|
|
|
@ -88,7 +88,7 @@ def backfill_content_checksums_and_torrent_pieces(piece_length):
|
|||
max_id):
|
||||
locations = _get_image_storage_locations(candidate_storage.id)
|
||||
|
||||
checksum = ImageStorage.content_checksum
|
||||
checksum = candidate_storage.content_checksum
|
||||
torrent_pieces = ''
|
||||
with CloseForLongOperation(app.config):
|
||||
try:
|
||||
|
|
Reference in a new issue