Commit f938003c authored by 吴升宇's avatar 吴升宇

Merge branch 'wsy3' into 'master'

Wsy3

See merge request alpha/physical!539
parents e15bad82 44631b40
......@@ -13,6 +13,14 @@ app = Celery('physical')
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
app.conf.ONCE = {
'backend': 'celery_once.backends.Redis',
'settings': {
'url': settings.CELERY_BROKER_URL,
'default_timeout': 60 * 60
}
}
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
......
......@@ -14,6 +14,7 @@ gevent==1.3.7
pypinyin==0.34.1
numpy==1.16.2
lz4==2.1.6
celery_once==3.0.1
git+ssh://git@git.wanmeizhensuo.com/backend/gm-rpcd.git@master
git+ssh://git@git.wanmeizhensuo.com/backend/helios.git@master
......
......@@ -8,6 +8,7 @@ import json
import redis
import smtplib
from celery import shared_task
from celery_once import QueueOnce
from libs.cache import redis_client
from email.mime.text import MIMEText
from email.utils import formataddr
......@@ -114,7 +115,7 @@ def logins(user_id):
return None
@shared_task(retry_kwargs={'max_retries': 0})
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def click(cookies_get, id):
# 点赞
try:
......@@ -148,7 +149,7 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0})
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def reply(cookies_get, id, content):
try:
post_dict = {
......@@ -272,7 +273,7 @@ def get_comments():
return None
@shared_task(retry_kwargs={'max_retries': 0})
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def follow(cookies_get, id):
try:
post_dict = {
......@@ -438,7 +439,7 @@ def set_reply_to_redis():
logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0})
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def reply2(cookies_get, id, content, replied_id):
try:
post_dict = {
......@@ -459,7 +460,7 @@ def reply2(cookies_get, id, content, replied_id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0})
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def pictorial_reply(cookies_get, id, content):
try:
post_dict = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment