From 78ee38a4b99b3caf3b5a5a4386a03e9e9aad3198 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sun, 13 Nov 2022 10:30:44 +1100 Subject: [PATCH] backfiller: Don't consider 404s for chat batches to be an error --- backfiller/backfiller/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backfiller/backfiller/main.py b/backfiller/backfiller/main.py index 3240368..bd47aaf 100644 --- a/backfiller/backfiller/main.py +++ b/backfiller/backfiller/main.py @@ -151,6 +151,12 @@ def get_remote_segment(base_dir, node, channel, quality, hour, missing_segment, uri = '{}/segments/{}/{}/{}/{}'.format(node, channel, quality, hour, missing_segment) resp = requests.get(uri, stream=True, timeout=timeout, metric_name='get_remote_segment') + # When backfilling chat batches, it's common for the batch to have been replaced + # by the time we try to pull it, as it has been merged into another batch. + # We don't consider this an error. + if resp.status_code == 404 and quality == 'chat': + logger.info("Ignoring missing chat batch at url: {}".format(uri)) + return resp.raise_for_status() with open(temp_path, 'wb') as f: