Skip to content

Commit

Permalink
Stop on docker status instead of checking db pool or service.started …
Browse files Browse the repository at this point in the history
…as there is a race condition there
  • Loading branch information
sonicaj committed Aug 28, 2024
1 parent 9715c85 commit d9057f3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/middlewared/middlewared/plugins/apps/stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time

from middlewared.event import EventSource
from middlewared.plugins.docker.state_utils import Status
from middlewared.schema import Dict, Int, Str, List
from middlewared.service import CallError
from middlewared.validators import Range
Expand Down Expand Up @@ -63,10 +64,7 @@ def run_sync(self):
old_projects_stats = project_stats
time.sleep(interval)
except Exception:
if self.middleware.call_sync('docker.config')['pool'] is None:
return
if self.middleware.call_sync('service.started', 'docker') is False:
self.middleware.logger.error('Unable to retrieve app stats as docker service has been stopped')
if self.middleware.call_sync('docker.status')['status'] != Status.RUNNING.value:
return

raise
Expand Down

0 comments on commit d9057f3

Please sign in to comment.