fix: celery worker for issue activities (#744)

* dev: update celery configuration to root folder

* dev: update import for celery

* fix: worker to deserialize data
This commit is contained in:
pablohashescobar 2023-04-08 15:46:05 +05:30 committed by GitHub
parent c21fb6e942
commit d88a95b1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 5 deletions

View File

@ -1,2 +1,2 @@
web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker plane.asgi:application --bind 0.0.0.0:$PORT --config gunicorn.config.py --max-requests 10000 --max-requests-jitter 1000 --access-logfile -
worker: celery -A plane.settings.celery worker -l info
worker: celery -A plane worker -l info

View File

@ -0,0 +1,3 @@
from .celery import app as celery_app
__all__ = ('celery_app',)

View File

@ -136,6 +136,7 @@ def track_priority(
comment=f"{actor.email} updated the priority to {requested_data.get('priority')}",
)
)
print(issue_activities)
# Track chnages in state of the issue
@ -651,6 +652,18 @@ def update_issue_activity(
"cycles_list": track_cycles,
"modules_list": track_modules,
}
requested_data = (
json.loads(requested_data)
if requested_data is not None
else None
)
current_instance = (
json.loads(current_instance)
if current_instance is not None
else None
)
for key in requested_data:
func = ISSUE_ACTIVITY_MAPPER.get(key, None)
if func is not None:
@ -786,5 +799,6 @@ def issue_activity(
)
return
except Exception as e:
print(e)
capture_exception(e)
return

View File

@ -1,10 +1,12 @@
import os
from celery import Celery
from django.conf import settings
from plane.settings.redis import redis_instance
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
ri = redis_instance()
app = Celery("plane")
# Using a string here means the worker will not have to

View File

@ -1,3 +0,0 @@
from .celery import app as celery_app
__all__ = ('celery_app',)

View File

@ -207,3 +207,7 @@ SIMPLE_JWT = {
"SLIDING_TOKEN_LIFETIME": timedelta(minutes=5),
"SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=1),
}
CELERY_TIMEZONE = TIME_ZONE
CELERY_TASK_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['application/json']