feature: implements deduplication mechanist for celery messages
This commit is contained in:
parent
126269feef
commit
9555056af7
8 changed files with 195 additions and 19 deletions
|
|
@ -25,6 +25,7 @@ import deform.widget
|
|||
import colander
|
||||
|
||||
from rhodecode import events
|
||||
from rhodecode.lib.celerylib.uniqueue_tasks import RequestContextAndUniqueByPayloadTask
|
||||
from rhodecode.model.validation_schema.widgets import CheckboxChoiceWidgetDesc
|
||||
from rhodecode.translation import _
|
||||
from rhodecode.lib import helpers as h
|
||||
|
|
@ -140,7 +141,7 @@ class SlackIntegrationType(IntegrationTypeBase):
|
|||
run_task(post_text_to_slack, self.settings, slack_data)
|
||||
|
||||
|
||||
@async_task(ignore_result=True, base=RequestContextTask)
|
||||
@async_task(ignore_result=True, base=RequestContextAndUniqueByPayloadTask)
|
||||
def post_text_to_slack(settings, slack_data: SlackData):
|
||||
# because JSON serialization, if we run async with celery, deserialize to SlackData
|
||||
if isinstance(slack_data, dict):
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import colander
|
|||
|
||||
import rhodecode
|
||||
from rhodecode import events
|
||||
from rhodecode.lib.celerylib.uniqueue_tasks import RequestContextAndUniqueByPayloadTask
|
||||
from rhodecode.lib.colander_utils import strip_whitespace
|
||||
from rhodecode.model.validation_schema.widgets import CheckboxChoiceWidgetDesc
|
||||
from rhodecode.translation import _
|
||||
|
|
@ -36,7 +37,7 @@ from rhodecode.integrations.types.base import (
|
|||
requests_retry_call,
|
||||
)
|
||||
from rhodecode.integrations.types.handlers.webhook import WebhookDataHandler
|
||||
from rhodecode.lib.celerylib import run_task, async_task, RequestContextTask
|
||||
from rhodecode.lib.celerylib import run_task, async_task
|
||||
from rhodecode.model.validation_schema import widgets
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -191,7 +192,7 @@ class WebhookIntegrationType(IntegrationTypeBase):
|
|||
run_task(post_to_webhook, self.settings, url_calls)
|
||||
|
||||
|
||||
@async_task(ignore_result=True, base=RequestContextTask)
|
||||
@async_task(ignore_result=True, base=RequestContextAndUniqueByPayloadTask)
|
||||
def post_to_webhook(settings, url_calls):
|
||||
"""
|
||||
Example data::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue