remove celery and use dramatiq
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import functools
|
||||
import json
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
from django.http import HttpResponse, QueryDict
|
||||
from django.utils.decorators import method_decorator
|
||||
@@ -98,6 +97,8 @@ class APIView(View):
|
||||
elif isinstance(errors, list):
|
||||
return self.extract_errors(errors[0], key)
|
||||
|
||||
return key, errors
|
||||
|
||||
def invalid_serializer(self, serializer):
|
||||
key, error = self.extract_errors(serializer.errors)
|
||||
if key == "non_field_errors":
|
||||
|
||||
@@ -81,3 +81,7 @@ def send_email(smtp_config, from_name, to_email, to_name, subject, content):
|
||||
|
||||
def get_env(name, default=""):
|
||||
return os.environ.get(name, default)
|
||||
|
||||
|
||||
def DRAMATIQ_WORKER_ARGS(time_limit=3600_000, max_retries=0, max_age=7200_000):
|
||||
return {"max_retries": max_retries, "time_limit": time_limit, "max_age": max_age}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import os
|
||||
from celery import shared_task
|
||||
import dramatiq
|
||||
|
||||
from utils.shortcuts import DRAMATIQ_WORKER_ARGS
|
||||
|
||||
|
||||
@shared_task
|
||||
@dramatiq.actor(**DRAMATIQ_WORKER_ARGS())
|
||||
def delete_files(*args):
|
||||
for item in args:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user