From 7162849f0cf243858b8f52a955c1f06b78aa13ad Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 24 Aug 2023 11:52:13 +1000 Subject: [PATCH] main: Added catch for no workers --- master/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/master/main.py b/master/main.py index a20c694..7cd91f9 100644 --- a/master/main.py +++ b/master/main.py @@ -152,6 +152,10 @@ def list_workers(): workers = workers_file.readlines() workers_file.close() + # Check if there are any workers + if len(workers) == 0: + return jsonify({'error': 'No workers available', 'success': 'false'}) + worker_list = [] for worker in workers: # Check worker status