From bb47ae5f296fb694504c6f22608ac4bf2bf5b670 Mon Sep 17 00:00:00 2001 From: Francesco Nazzaro Date: Fri, 17 Jan 2025 12:31:09 +0100 Subject: [PATCH] Add broker_max_dismissed_requests configuration and update dispatcher limit --- cads_broker/config.py | 1 + cads_broker/dispatcher.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cads_broker/config.py b/cads_broker/config.py index b9320ae6..56130469 100644 --- a/cads_broker/config.py +++ b/cads_broker/config.py @@ -39,6 +39,7 @@ class BrokerConfig(pydantic_settings.BaseSettings): broker_requeue_limit: int = 3 broker_max_internal_scheduler_tasks: int = 500 broker_max_accepted_requests: int = 2000 + broker_max_dismissed_requests: int = 100 broker_cancel_stuck_requests_cache_ttl: int = 60 broker_stuck_requests_limit_minutes: int = 15 diff --git a/cads_broker/dispatcher.py b/cads_broker/dispatcher.py index 1b1a461d..3d452f22 100644 --- a/cads_broker/dispatcher.py +++ b/cads_broker/dispatcher.py @@ -415,7 +415,7 @@ def sync_database(self, session: sa.orm.Session) -> None: # the retrieve API sets the status to "dismissed", # here the broker fixes the QoS and queue status accordingly dismissed_requests = db.get_dismissed_requests( - session, limit=CONFIG.broker_max_accepted_requests + session, limit=CONFIG.broker_max_dismissed_requests ) for request in dismissed_requests: if future := self.futures.pop(request.request_uid, None):