Skip to content

Commit

Permalink
Merge pull request #4248 from guardian/ingestion/don't-retry-Unsuppor…
Browse files Browse the repository at this point in the history
…tedMimeTypeException

don't retry `UnsupportedMimeTypeException` just move straight to fail bucket
  • Loading branch information
twrichards authored Feb 20, 2024
2 parents 1b02b42 + 14ced0b commit 59b42d8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions image-loader/app/controllers/ImageLoaderController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,15 @@ class ImageLoaderController(auth: Authentication,
metrics.successfulIngestsFromQueue.incrementBothWithAndWithoutDimensions(metricDimensions).run
logger.info(logMarker, s"Successfully processed image ${digestedFile.file.getName}")
store.deleteObjectFromIngestBucket(s3IngestObject.key)
} recover { case t: Throwable =>
metrics.failedIngestsFromQueue.incrementBothWithAndWithoutDimensions(metricDimensions).run
logger.error(logMarker, s"Failed to process file. Moving to fail bucket.", t)
store.moveObjectToFailedBucket(s3IngestObject.key)
} recover {
case _: UnsupportedMimeTypeException =>
metrics.failedIngestsFromQueue.incrementBothWithAndWithoutDimensions(metricDimensions).run
logger.info(logMarker, s"Unsupported mime type. Moving straight to fail bucket.")
store.moveObjectToFailedBucket(s3IngestObject.key)
case t: Throwable =>
metrics.failedIngestsFromQueue.incrementBothWithAndWithoutDimensions(metricDimensions).run
logger.error(logMarker, s"Failed to process file. Moving to fail bucket.", t)
store.moveObjectToFailedBucket(s3IngestObject.key)
}
}
}
Expand Down

0 comments on commit 59b42d8

Please sign in to comment.