mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-24 17:24:43 +01:00
Feat celery run (#860)
* avoid calling post save signals * remove stale celery ids that prevent new services from starting
This commit is contained in:
parent
e7ce9ef5c0
commit
e9739bab45
@ -67,4 +67,5 @@ fi
|
||||
if [ X"$ENABLE_CELERY_LONG" = X"yes" ] ; then
|
||||
echo "Enabling celery-long task worker"
|
||||
cp deploy/docker/supervisord/supervisord-celery_long.conf /etc/supervisor/conf.d/supervisord-celery_long.conf
|
||||
rm /var/run/mediacms/* -f # remove any stale id, so that on forced restarts of celery workers there are no stale processes that prevent new ones
|
||||
fi
|
||||
|
@ -644,7 +644,11 @@ def save_user_action(user_or_session, friendly_token=None, action="watch", extra
|
||||
|
||||
if action == "watch":
|
||||
media.views += 1
|
||||
media.save(update_fields=["views"])
|
||||
Media.objects.filter(friendly_token=friendly_token).update(views=media.views)
|
||||
|
||||
# update field without calling save, to avoid post_save signals being triggered
|
||||
# same in other actions
|
||||
|
||||
elif action == "report":
|
||||
media.reported_times += 1
|
||||
|
||||
@ -659,10 +663,10 @@ def save_user_action(user_or_session, friendly_token=None, action="watch", extra
|
||||
)
|
||||
elif action == "like":
|
||||
media.likes += 1
|
||||
media.save(update_fields=["likes"])
|
||||
Media.objects.filter(friendly_token=friendly_token).update(likes=media.likes)
|
||||
elif action == "dislike":
|
||||
media.dislikes += 1
|
||||
media.save(update_fields=["dislikes"])
|
||||
Media.objects.filter(friendly_token=friendly_token).update(dislikes=media.dislikes)
|
||||
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user