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
15 changes: 8 additions & 7 deletions delfin/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ def kill(self):
"""Destroy the service object in the datastore."""
self.stop()

def stop(self):
def stop(self, graceful=False):
# Try to shut the connection down, but if we get any sort of
# errors, go ahead and ignore them.. as we're shutting down anyway
try:
self.rpcserver.stop()
except Exception:
pass
if hasattr(self, 'rpcserver'):
self.rpcserver.stop()
except Exception as e:
LOG.error('Stop the rpc server failed, the reason is %s.', e)
for x in self.timers:
try:
x.stop()
except Exception:
pass
except Exception as e:
LOG.error('Stop the timers failed, the reason is %s.', e)
if self.coordinator:
try:
coordination.LOCK_COORDINATOR.stop()
Expand All @@ -208,7 +209,7 @@ def stop(self):

self.timers = []

super(Service, self).stop()
super(Service, self).stop(graceful)

def wait(self):
for x in self.timers:
Expand Down