@@ -33,15 +33,11 @@ def _process_picture(
3333 old = old or []
3434 storage = utils .reconstruct (* storage )
3535 if new :
36- try :
37- with storage .open (file_name ) as fs :
38- with Image .open (fs ) as img :
39- for picture in new :
40- picture = utils .reconstruct (* picture )
41- picture .save (img )
42- except FileNotFoundError :
43- # The file no longer exists (for example, because it was deleted or replaced).
44- return
36+ with storage .open (file_name ) as fs :
37+ with Image .open (fs ) as img :
38+ for picture in new :
39+ picture = utils .reconstruct (* picture )
40+ picture .save (img )
4541
4642 for picture in old :
4743 picture = utils .reconstruct (* picture )
@@ -57,7 +53,7 @@ def _process_picture(
5753 pass
5854else :
5955
60- @dramatiq .actor (queue_name = conf .get_settings ().QUEUE_NAME )
56+ @dramatiq .actor (queue_name = conf .get_settings ().QUEUE_NAME , throws = ( FileNotFoundError ,) )
6157 def process_picture_with_dramatiq (
6258 storage : tuple [str , list , dict ],
6359 file_name : str ,
@@ -91,6 +87,7 @@ def process_picture( # noqa: F811
9187 @shared_task (
9288 ignore_results = True ,
9389 retry_backoff = True ,
90+ dont_autoretry_for = (FileNotFoundError ,),
9491 )
9592 def process_picture_with_celery (
9693 storage : tuple [str , list , dict ],
0 commit comments