use dynamic delay retry
This commit is contained in:
parent
7961e016eb
commit
49a1b62f21
@ -3,6 +3,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from telegram.error import RetryAfter
|
||||||
|
|
||||||
from config.celery import app
|
from config.celery import app
|
||||||
from djconfig import config
|
from djconfig import config
|
||||||
|
|
||||||
@ -32,6 +34,8 @@ def upload_image_rpc(self, queued_image_pk, fpath, caption):
|
|||||||
qi.processed = True
|
qi.processed = True
|
||||||
qi.save()
|
qi.save()
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
|
except RetryAfter as e:
|
||||||
|
raise self.retry(exc=e, countdown=int(e.retry_after))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise self.retry(exc=e, countdown=5)
|
raise self.retry(exc=e, countdown=5)
|
||||||
|
Loading…
Reference in New Issue
Block a user