forked from CGM_Public/pretix_original
Set acks_late=True on celery tasks where we would prefer double execution over failure
This commit is contained in:
@@ -70,6 +70,9 @@ and ``checkin_list``.
|
|||||||
only include the minimum amount of data necessary for you to fetch the changed objects from our
|
only include the minimum amount of data necessary for you to fetch the changed objects from our
|
||||||
:ref:`rest-api` in an authenticated way.
|
:ref:`rest-api` in an authenticated way.
|
||||||
|
|
||||||
|
.. warning:: In very rare cases, you could receive the same webhook notification twice. We try to avoid it, but we
|
||||||
|
prefer it over missing a notification.
|
||||||
|
|
||||||
If you want to further prevent others from accessing your webhook URL, you can also use `Basic authentication`_ and
|
If you want to further prevent others from accessing your webhook URL, you can also use `Basic authentication`_ and
|
||||||
supply the URL to us in the format of ``https://username:password@domain.com/path/``.
|
supply the URL to us in the format of ``https://username:password@domain.com/path/``.
|
||||||
We recommend that you use HTTPS for your webhook URL and might require it in the future. If HTTPS is used, we require
|
We recommend that you use HTTPS for your webhook URL and might require it in the future. If HTTPS is used, we require
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ def register_default_webhook_events(sender, **kwargs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=TransactionAwareTask)
|
@app.task(base=TransactionAwareTask, acks_late=True)
|
||||||
def notify_webhooks(logentry_id: int):
|
def notify_webhooks(logentry_id: int):
|
||||||
logentry = LogEntry.all.select_related('event', 'event__organizer').get(id=logentry_id)
|
logentry = LogEntry.all.select_related('event', 'event__organizer').get(id=logentry_id)
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ def notify_webhooks(logentry_id: int):
|
|||||||
send_webhook.apply_async(args=(logentry_id, notification_type.action_type, wh.pk))
|
send_webhook.apply_async(args=(logentry_id, notification_type.action_type, wh.pk))
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=ProfiledTask, bind=True, max_retries=9)
|
@app.task(base=ProfiledTask, bind=True, max_retries=9, acks_late=True)
|
||||||
def send_webhook(self, logentry_id: int, action_type: str, webhook_id: int):
|
def send_webhook(self, logentry_id: int, action_type: str, webhook_id: int):
|
||||||
# 9 retries with 2**(2*x) timing is roughly 72 hours
|
# 9 retries with 2**(2*x) timing is roughly 72 hours
|
||||||
with scopes_disabled():
|
with scopes_disabled():
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ def _send_mail(order: Order, subject: LazyI18nString, message: LazyI18nString, s
|
|||||||
logger.exception('Order canceled email could not be sent to attendee')
|
logger.exception('Order canceled email could not be sent to attendee')
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=ProfiledEventTask, bind=True, max_retries=5, default_retry_delay=1, throws=(OrderError,))
|
@app.task(base=ProfiledEventTask, bind=True, max_retries=5, default_retry_delay=1, throws=(OrderError,),
|
||||||
|
acks_late=True)
|
||||||
def cancel_event(self, event: Event, subevent: int, auto_refund: bool, keep_fee_fixed: str,
|
def cancel_event(self, event: Event, subevent: int, auto_refund: bool, keep_fee_fixed: str,
|
||||||
keep_fee_percentage: str, keep_fees: list=None, manual_refund: bool=False,
|
keep_fee_percentage: str, keep_fees: list=None, manual_refund: bool=False,
|
||||||
send: bool=False, send_subject: dict=None, send_message: dict=None,
|
send: bool=False, send_subject: dict=None, send_message: dict=None,
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class CustomEmail(EmailMultiAlternatives):
|
|||||||
return super()._create_mime_attachment(content, mimetype)
|
return super()._create_mime_attachment(content, mimetype)
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=TransactionAwareTask, bind=True)
|
@app.task(base=TransactionAwareTask, bind=True, acks_late=True)
|
||||||
def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: str, sender: str,
|
def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: str, sender: str,
|
||||||
event: int=None, position: int=None, headers: dict=None, bcc: List[str]=None,
|
event: int=None, position: int=None, headers: dict=None, bcc: List[str]=None,
|
||||||
invoices: List[int]=None, order: int=None, attach_tickets=False, user=None,
|
invoices: List[int]=None, order: int=None, attach_tickets=False, user=None,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from pretix.celery_app import app
|
|||||||
from pretix.helpers.urls import build_absolute_uri
|
from pretix.helpers.urls import build_absolute_uri
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=TransactionAwareTask)
|
@app.task(base=TransactionAwareTask, acks_late=True)
|
||||||
@scopes_disabled()
|
@scopes_disabled()
|
||||||
def notify(logentry_id: int):
|
def notify(logentry_id: int):
|
||||||
logentry = LogEntry.all.select_related('event', 'event__organizer').get(id=logentry_id)
|
logentry = LogEntry.all.select_related('event', 'event__organizer').get(id=logentry_id)
|
||||||
@@ -66,7 +66,7 @@ def notify(logentry_id: int):
|
|||||||
send_notification.apply_async(args=(logentry_id, notification_type.action_type, user.pk, method))
|
send_notification.apply_async(args=(logentry_id, notification_type.action_type, user.pk, method))
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=ProfiledTask)
|
@app.task(base=ProfiledTask, acks_late=True)
|
||||||
def send_notification(logentry_id: int, action_type: str, user_id: int, method: str):
|
def send_notification(logentry_id: int, action_type: str, user_id: int, method: str):
|
||||||
logentry = LogEntry.all.get(id=logentry_id)
|
logentry = LogEntry.all.get(id=logentry_id)
|
||||||
if logentry.event:
|
if logentry.event:
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ def get_tickets_for_order(order, base_position=None):
|
|||||||
return tickets
|
return tickets
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=EventTask)
|
@app.task(base=EventTask, acks_late=True)
|
||||||
def invalidate_cache(event: Event, item: int=None, provider: str=None, order: int=None, **kwargs):
|
def invalidate_cache(event: Event, item: int=None, provider: str=None, order: int=None, **kwargs):
|
||||||
qs = CachedTicket.objects.filter(order_position__order__event=event)
|
qs = CachedTicket.objects.filter(order_position__order__event=event)
|
||||||
qsc = CachedCombinedTicket.objects.filter(order__event=event)
|
qsc = CachedCombinedTicket.objects.filter(order__event=event)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from pretix.base.services.tasks import TransactionAwareProfiledEventTask
|
|||||||
from pretix.celery_app import app
|
from pretix.celery_app import app
|
||||||
|
|
||||||
|
|
||||||
@app.task(base=TransactionAwareProfiledEventTask)
|
@app.task(base=TransactionAwareProfiledEventTask, acks_late=True)
|
||||||
def vouchers_send(event: Event, vouchers: list, subject: str, message: str, recipients: list, user: int) -> None:
|
def vouchers_send(event: Event, vouchers: list, subject: str, message: str, recipients: list, user: int) -> None:
|
||||||
vouchers = list(Voucher.objects.filter(id__in=vouchers).order_by('id'))
|
vouchers = list(Voucher.objects.filter(id__in=vouchers).order_by('id'))
|
||||||
user = User.objects.get(pk=user)
|
user = User.objects.get(pk=user)
|
||||||
|
|||||||
Reference in New Issue
Block a user