From f91fcd518a942801dc8fedbaa60b93287e4d8c50 Mon Sep 17 00:00:00 2001 From: Wesley Aptekar-Cassels Date: Thu, 6 Apr 2023 01:18:35 -0400 Subject: [PATCH] Increase network timeout in Celery tasks Since Celery tasks don't affect interactive latency, we should have a more generous timeout. This also allows admins to set the timeout for Celery and the web frontend separately, without breaking backwards compatibility with the previous environment variable. --- bookwyrm/settings.py | 2 +- celerywyrm/settings.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 419b76195..8dcf90fcb 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -226,7 +226,7 @@ STREAMS = [ # total time in seconds that the instance will spend searching connectors SEARCH_TIMEOUT = env.int("SEARCH_TIMEOUT", 8) # timeout for a query to an individual connector -QUERY_TIMEOUT = env.int("QUERY_TIMEOUT", 5) +QUERY_TIMEOUT = env.int("INTERACTIVE_QUERY_TIMEOUT", env.int("QUERY_TIMEOUT", 5)) # Redis cache backend if env.bool("USE_DUMMY_CACHE", False): diff --git a/celerywyrm/settings.py b/celerywyrm/settings.py index c1e533ac3..aa08a2417 100644 --- a/celerywyrm/settings.py +++ b/celerywyrm/settings.py @@ -3,6 +3,8 @@ # pylint: disable=unused-wildcard-import from bookwyrm.settings import * +QUERY_TIMEOUT = env.int("CELERY_QUERY_TIMEOUT", env.int("QUERY_TIMEOUT", 30)) + # pylint: disable=line-too-long REDIS_BROKER_PASSWORD = requests.utils.quote(env("REDIS_BROKER_PASSWORD", "")) REDIS_BROKER_HOST = env("REDIS_BROKER_HOST", "redis_broker")