forked from github/plane
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:
parent
c21fb6e942
commit
d88a95b1e9
@ -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 -
|
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
|
@ -0,0 +1,3 @@
|
|||||||
|
from .celery import app as celery_app
|
||||||
|
|
||||||
|
__all__ = ('celery_app',)
|
@ -136,6 +136,7 @@ def track_priority(
|
|||||||
comment=f"{actor.email} updated the priority to {requested_data.get('priority')}",
|
comment=f"{actor.email} updated the priority to {requested_data.get('priority')}",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
print(issue_activities)
|
||||||
|
|
||||||
|
|
||||||
# Track chnages in state of the issue
|
# Track chnages in state of the issue
|
||||||
@ -651,6 +652,18 @@ def update_issue_activity(
|
|||||||
"cycles_list": track_cycles,
|
"cycles_list": track_cycles,
|
||||||
"modules_list": track_modules,
|
"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:
|
for key in requested_data:
|
||||||
func = ISSUE_ACTIVITY_MAPPER.get(key, None)
|
func = ISSUE_ACTIVITY_MAPPER.get(key, None)
|
||||||
if func is not None:
|
if func is not None:
|
||||||
@ -786,5 +799,6 @@ def issue_activity(
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
capture_exception(e)
|
capture_exception(e)
|
||||||
return
|
return
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
from celery import Celery
|
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.
|
# Set the default Django settings module for the 'celery' program.
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
||||||
|
|
||||||
|
ri = redis_instance()
|
||||||
|
|
||||||
app = Celery("plane")
|
app = Celery("plane")
|
||||||
|
|
||||||
# Using a string here means the worker will not have to
|
# Using a string here means the worker will not have to
|
@ -1,3 +0,0 @@
|
|||||||
from .celery import app as celery_app
|
|
||||||
|
|
||||||
__all__ = ('celery_app',)
|
|
@ -207,3 +207,7 @@ SIMPLE_JWT = {
|
|||||||
"SLIDING_TOKEN_LIFETIME": timedelta(minutes=5),
|
"SLIDING_TOKEN_LIFETIME": timedelta(minutes=5),
|
||||||
"SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=1),
|
"SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CELERY_TIMEZONE = TIME_ZONE
|
||||||
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
|
CELERY_ACCEPT_CONTENT = ['application/json']
|
Loading…
Reference in New Issue
Block a user