fix: celery task timeout
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import HttpRequest, HttpResponse, FileResponse, HttpResponseBadRequest
|
from django.http import HttpRequest, FileResponse, HttpResponseBadRequest
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
|
|
||||||
from epub2go.convert import get_all_books, Book, allbooks_url
|
from epub2go.convert import get_all_books, allbooks_url
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
@@ -35,7 +35,7 @@ def index(request: HttpRequest):
|
|||||||
else:
|
else:
|
||||||
# download file
|
# download file
|
||||||
result = getEpub.delay(targetParam)
|
result = getEpub.delay(targetParam)
|
||||||
fpath = result.get(timeout=60)
|
fpath = result.get(timeout=120)
|
||||||
fname = os.path.basename(fpath)
|
fname = os.path.basename(fpath)
|
||||||
file = open(fpath, 'rb')
|
file = open(fpath, 'rb')
|
||||||
response = FileResponse(file)
|
response = FileResponse(file)
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ DATABASES = {
|
|||||||
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
|
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
|
||||||
CELERY_RESULT_BACKEND = os.environ.get('CELERY_RESULT_BACKEND', default="redis://localhost:6379/0")
|
CELERY_RESULT_BACKEND = os.environ.get('CELERY_RESULT_BACKEND', default="redis://localhost:6379/0")
|
||||||
CELERY_TASK_ALWAYS_EAGER = True
|
CELERY_TASK_ALWAYS_EAGER = True
|
||||||
|
CELERY_TASK_SOFT_TIME_LIMIT = 300
|
||||||
|
CELERY_TASK_TIME_LIMIT = 360
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||||
|
|||||||
Reference in New Issue
Block a user