Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion splunklib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,15 @@ def restart(self, timeout=None):
while datetime.now() - start < diff:
try:
self.login()
if not self.restart_required:
if self.restart_required:
# Prevent a burst of requests from bombarding Splunk.
# Splunk does not stop the API immediately when /services/server/control/restart
# responds, thus the login call (above) will still succeed until the server
# is actually stopped. Based on the presence of restart_required message,
# that we have added before calling restart, we know that the server did not stop yet.
sleep(1)
continue
else:
return result
except Exception as e:
sleep(1)
Expand Down