Simplify distributed worker check to use connected clients

parent cc35fff0
......@@ -122,13 +122,9 @@ class QueueManager:
def _has_distributed_worker(self, process_type: str) -> bool:
"""Check if there is a distributed worker available for the process type."""
from .database import get_db_connection
conn = get_db_connection()
cursor = conn.cursor()
cursor.execute('SELECT id FROM cluster_processes WHERE process_name LIKE ? AND status = ?', (f'{process_type}%', 'active'))
result = cursor.fetchone()
conn.close()
return result is not None
from .database import get_connected_cluster_clients
clients = get_connected_cluster_clients()
return len(clients) > 0
def _process_queue(self) -> None:
"""Background thread to process queued jobs."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment