mirror of
https://github.com/codl/forget
synced 2025-01-07 12:52:34 +01:00
add sentry support to celery tasks too
This commit is contained in:
parent
a1b9cb4311
commit
a7f68fde9a
7
tasks.py
7
tasks.py
@ -23,6 +23,13 @@ app.conf.task_default_queue = 'default'
|
|||||||
app.conf.task_default_exchange = 'celery'
|
app.conf.task_default_exchange = 'celery'
|
||||||
app.conf.task_default_exchange_type = 'direct'
|
app.conf.task_default_exchange_type = 'direct'
|
||||||
|
|
||||||
|
if 'SENTRY_DSN' in flaskapp.config:
|
||||||
|
from raven import Client
|
||||||
|
from raven.contrib.celery import register_signal, register_logger_signal
|
||||||
|
sentry = Client(flaskapp.config['SENTRY_DSN'])
|
||||||
|
register_logger_signal(sentry)
|
||||||
|
register_signal(sentry)
|
||||||
|
|
||||||
@app.task(autoretry_for=(TwitterError, URLError))
|
@app.task(autoretry_for=(TwitterError, URLError))
|
||||||
def fetch_acc(id, cursor=None):
|
def fetch_acc(id, cursor=None):
|
||||||
acc = Account.query.get(id)
|
acc = Account.query.get(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user