diff --git a/shell/src/interpreter.py b/shell/src/interpreter.py
index 011b9a23..625fce88 100644
--- a/shell/src/interpreter.py
+++ b/shell/src/interpreter.py
@@ -3218,11 +3218,13 @@ class DrainReplicas(object):
self.threadpool = []
def stopThreads(self):
- self.interpreter.ok('Drain process Stopped, Waiting max 10 seconds for each running thread to end...')
+ self.interpreter.ok('Drain process Stopped, Waiting max 60 seconds + 5 seconds for each running thread')
for t in self.threadpool:
t.stop()
+ join_start = time.monotonic()
for t in self.threadpool:
- t.join(10)
+ wait = 60 - (time.monotonic() - join_start)
+ t.join(wait if wait > 5 else 5)
self.printDrainErrors()
def printDrainErrors(self):
@@ -3291,8 +3293,11 @@ class DrainReplicas(object):
for t in self.threadpool:
t.stop()
+ self.interpreter.ok("Joining %i threads (wait max 3600s + 5s for each thread)\n" % len(self.threadpool))
+ join_start = time.monotonic()
for t in self.threadpool:
- t.join(10)
+ wait = 3600 - (time.monotonic() - join_start)
+ t.join(wait if wait > 5 else 5)
if self.parameters['move']:
self.interpreter.ok("Move Process completed\n")
else: