Skip to content

Commit 3eda492

Browse files
authored
Merge pull request #649 from splunk/dev/MP/restart-always-sleep
Always call sleep while restarting
2 parents 202557a + be871aa commit 3eda492

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

splunklib/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,15 @@ def restart(self, timeout=None):
618618
while datetime.now() - start < diff:
619619
try:
620620
self.login()
621-
if not self.restart_required:
621+
if self.restart_required:
622+
# Prevent a burst of requests from bombarding Splunk.
623+
# Splunk does not stop the API immediately when /services/server/control/restart
624+
# responds, thus the login call (above) will still succeed until the server
625+
# is actually stopped. Based on the presence of restart_required message,
626+
# that we have added before calling restart, we know that the server did not stop yet.
627+
sleep(1)
628+
continue
629+
else:
622630
return result
623631
except Exception as e:
624632
sleep(1)

0 commit comments

Comments
 (0)