Fixes for content checksum and torrent pieces backfill

Remove null handler from app.py, was silencing other logs
This commit is contained in:
Jake Moshenko 2016-02-11 16:53:18 -05:00
parent 2a350460d5
commit 88d84aa182
3 changed files with 6 additions and 7 deletions

3
app.py
View file

@ -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())

View file

@ -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))

View file

@ -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: