Commit 99c8cb6b authored by 吴升宇's avatar 吴升宇

merge

parents 74f5d483 44631b40
Pipeline #3466 passed with stage
...@@ -12,7 +12,15 @@ app = Celery('physical') ...@@ -12,7 +12,15 @@ app = Celery('physical')
# the configuration object to child processes. # the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys # - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix. # should have a `CELERY_` prefix.
app.conf.ONCE.config_from_object('django.conf:settings', namespace='CELERY') 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. # Load task modules from all registered Django app configs.
app.autodiscover_tasks() app.autodiscover_tasks()
......
...@@ -115,7 +115,7 @@ def logins(user_id): ...@@ -115,7 +115,7 @@ def logins(user_id):
return None return None
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True}) @shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def click(cookies_get, id): def click(cookies_get, id):
# 点赞 # 点赞
try: try:
...@@ -149,7 +149,7 @@ def click(cookies_get, id): ...@@ -149,7 +149,7 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc()) logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True}) @shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def reply(cookies_get, id, content): def reply(cookies_get, id, content):
try: try:
post_dict = { post_dict = {
...@@ -273,7 +273,7 @@ def get_comments(): ...@@ -273,7 +273,7 @@ def get_comments():
return None return None
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True}) @shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def follow(cookies_get, id): def follow(cookies_get, id):
try: try:
post_dict = { post_dict = {
...@@ -439,7 +439,7 @@ def set_reply_to_redis(): ...@@ -439,7 +439,7 @@ def set_reply_to_redis():
logging.error("catch exception,logins:%s" % traceback.format_exc()) logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True}) @shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def reply2(cookies_get, id, content, replied_id): def reply2(cookies_get, id, content, replied_id):
try: try:
post_dict = { post_dict = {
...@@ -460,7 +460,7 @@ def reply2(cookies_get, id, content, replied_id): ...@@ -460,7 +460,7 @@ def reply2(cookies_get, id, content, replied_id):
logging.error("catch exception,logins:%s" % traceback.format_exc()) logging.error("catch exception,logins:%s" % traceback.format_exc())
@shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True}) @shared_task(retry_kwargs={'max_retries': 0}, base=QueueOnce, once={'graceful': True, 'unlock_before_run': True})
def pictorial_reply(cookies_get, id, content): def pictorial_reply(cookies_get, id, content):
try: try:
post_dict = { 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