Browse Source

Kill watchdog thread when engine is stopped

Step 1 of stopping the engine via api. Stop the watchdog thread,
so we don't do anymore monitoring.

Change-Id: I3d78834ab3cf81643260a47efec7c738f7a2f63f
Pranesh Pandurangan 4 years ago
parent
commit
4e4533796b
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      entropy/engine.py

+ 7
- 3
entropy/engine.py View File

@@ -74,6 +74,9 @@ class Engine(object):
74 74
         self._repairs = []
75 75
         self._known_routing_keys = set()
76 76
 
77
+        # Watchdog-related variables
78
+        self._watchdog_thread = None
79
+
77 80
         LOG.info('Created engine obj %s', self.name)
78 81
 
79 82
     # TODO(praneshp): Move to utils?
@@ -113,8 +116,8 @@ class Engine(object):
113 116
         self.futures.append(scheduler)
114 117
 
115 118
         # watchdog
116
-        watchdog_thread = self.start_watchdog()
117
-        watchdog_thread.join()
119
+        self._watchdog_thread = self.start_watchdog()
120
+        self._watchdog_thread.join()
118 121
 
119 122
     def schedule(self):
120 123
         while True:
@@ -202,7 +205,8 @@ class Engine(object):
202 205
             self.stop_engine()
203 206
 
204 207
     def stop_engine(self):
205
-        pass
208
+        # Stop watchdog monitoring
209
+        self._watchdog_thread.stop()
206 210
 
207 211
     def repair_modified(self):
208 212
         LOG.info('Repair configuration changed')

Loading…
Cancel
Save