From f659d4adb3a6c7d7f5cbc053f8e4f4535b315dbb Mon Sep 17 00:00:00 2001 From: Luciano Gervasoni Date: Fri, 20 Jun 2025 09:59:27 +0200 Subject: [PATCH] Scheduled tasks interval, env vars, view fix --- app_urls/core/settings.py | 3 +-- app_urls/fetcher/views.py | 7 +++++-- app_urls/scheduled_tasks.json | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app_urls/core/settings.py b/app_urls/core/settings.py index 40f839a..a7eaacb 100644 --- a/app_urls/core/settings.py +++ b/app_urls/core/settings.py @@ -119,7 +119,7 @@ SCHEDULER_CONFIG = SchedulerConfiguration( DEFAULT_SUCCESS_TTL=10 * 60, # Time To Live (TTL) in seconds to keep successful job results DEFAULT_FAILURE_TTL=365 * 24 * 60 * 60, # Time To Live (TTL) in seconds to keep job failure information DEFAULT_JOB_TTL=10 * 60, # Time To Live (TTL) in seconds to keep job information - DEFAULT_JOB_TIMEOUT=30 * 60, # timeout (seconds) for a job + DEFAULT_JOB_TIMEOUT=os.environ.get("JOB_DEFAULT_TIMEOUT", 60*30), # timeout (seconds) for a job # General configuration values DEFAULT_WORKER_TTL=10 * 60, # Time To Live (TTL) in seconds to keep worker information after last heartbeat DEFAULT_MAINTENANCE_TASK_INTERVAL=10 * 60, # The interval to run maintenance tasks in seconds. 10 minutes. @@ -127,7 +127,6 @@ SCHEDULER_CONFIG = SchedulerConfiguration( SCHEDULER_FALLBACK_PERIOD_SECS=120, # Period (secs) to wait before requiring to reacquire locks ) SCHEDULER_QUEUES: Dict[str, QueueConfiguration] = { - # 'default': QueueConfiguration(URL='redis://localhost:6379/0'), 'default': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))), 'high': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))), 'low': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))), diff --git a/app_urls/fetcher/views.py b/app_urls/fetcher/views.py index 08f0675..3f773eb 100644 --- a/app_urls/fetcher/views.py +++ b/app_urls/fetcher/views.py @@ -45,8 +45,11 @@ def url_detail_view(request, id): url_content = {} ollama = OllamaClient() - # prompt_content = "{}\n{}\n{}".format(url_content.title, url_content.description, url_content.content) - prompt_content = "{}".format(url_content.content) + try: + # prompt_content = "{}\n{}\n{}".format(url_content.title, url_content.description, url_content.content) + prompt_content = "{}".format(url_content.content) + except Exception as e: + prompt_content = "" context = { 'url_item': url_item, diff --git a/app_urls/scheduled_tasks.json b/app_urls/scheduled_tasks.json index 3e39d54..23849e4 100644 --- a/app_urls/scheduled_tasks.json +++ b/app_urls/scheduled_tasks.json @@ -118,7 +118,7 @@ "result_ttl": 86400, "cron_string": null, "scheduled_time": "2025-01-01T00:00:00+00:00", - "interval": 1, + "interval": 8, "interval_unit": "hours", "successful_runs": 0, "failed_runs": 0, @@ -139,7 +139,7 @@ "result_ttl": 86400, "cron_string": null, "scheduled_time": "2025-01-01T00:00:00+00:00", - "interval": 1, + "interval": 2, "interval_unit": "hours", "successful_runs": 0, "failed_runs": 0,