fix: celery task timeout

This commit is contained in:
eneller
2025-07-04 07:56:05 +02:00
parent f570aef863
commit c7cb5a0f6d
2 changed files with 5 additions and 3 deletions

View File

@@ -1,8 +1,8 @@
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 epub2go.convert import get_all_books, Book, allbooks_url
from epub2go.convert import get_all_books, allbooks_url
import os
import glob
@@ -35,7 +35,7 @@ def index(request: HttpRequest):
else:
# download file
result = getEpub.delay(targetParam)
fpath = result.get(timeout=60)
fpath = result.get(timeout=120)
fname = os.path.basename(fpath)
file = open(fpath, 'rb')
response = FileResponse(file)

View File

@@ -85,6 +85,8 @@ DATABASES = {
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_TASK_ALWAYS_EAGER = True
CELERY_TASK_SOFT_TIME_LIMIT = 300
CELERY_TASK_TIME_LIMIT = 360
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/