mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
fix(oci): keep update results when one application fails
- Check that the Monitor answers on its socket, not only that it exists - Report the applications whose check failed instead of failing the whole request - Show those applications as not checked, without their older result - Tell the user in the menu when a check fails
This commit is contained in:
@@ -74,19 +74,19 @@ def check_applications(module, rows, report):
|
||||
module.check_app(vmid, app['id'], force=True, notify=False)
|
||||
|
||||
pool = ThreadPoolExecutor(max_workers=_CHECK_WORKERS, thread_name_prefix='oci-check')
|
||||
failed = False
|
||||
failed = []
|
||||
try:
|
||||
futures = [pool.submit(check_one, row) for row in rows]
|
||||
futures = {pool.submit(check_one, row): row['vmid'] for row in rows}
|
||||
for completed, future in enumerate(as_completed(futures), 1):
|
||||
try:
|
||||
future.result()
|
||||
except Exception:
|
||||
failed = True # One failure never stops the other applications.
|
||||
failed.append(futures[future]) # One failure never stops the other applications.
|
||||
report({'completed': completed, 'total': len(rows)})
|
||||
finally:
|
||||
stopped.set()
|
||||
pool.shutdown(wait=True, cancel_futures=True)
|
||||
report({'error': 'check_failed'} if failed else {'done': True})
|
||||
report({'done': True, 'failed': sorted(failed)})
|
||||
|
||||
|
||||
class _Handler(socketserver.StreamRequestHandler):
|
||||
|
||||
Reference in New Issue
Block a user