better re-start

This commit is contained in:
meejah 2020-05-12 16:56:46 -06:00
parent f52cd4363a
commit 7c8a7f973a

View File

@ -158,6 +158,13 @@ class StorageServer(object):
@inlineCallbacks
def restart(self, reactor, request):
"""
re-start our underlying process by issuing a TERM, waiting and
then running again. await_client_ready() will be done as well
Note that self.process and self.protocol will be new instances
after this.
"""
self.process.transport.signalProcess('TERM')
yield self.protocol.exited
self.process = yield _run_node(
@ -165,6 +172,9 @@ class StorageServer(object):
)
self.protocol = self.process.transport._protocol
@inlineCallbacks
def run(
@inlineCallbacks
def create_storage_server(reactor, request, temp_dir, introducer, flog_gatherer, name, web_port,
@ -198,12 +208,25 @@ class Client(object):
)
@inlineCallbacks
def restart(self, reactor, request):
def restart(self, reactor, request, servers=1):
"""
re-start our underlying process by issuing a TERM, waiting and
then running again.
:param int servers: number of server connections we will wait
for before being 'ready'
Note that self.process and self.protocol will be new instances
after this.
"""
self.process.transport.signalProcess('TERM')
yield self.protocol.exited
x = yield _run_node(
process = yield _run_node(
reactor, self.process.node_dir, request, None,
)
self.process = process
self.protocol = self.process.transport._protocol
# XXX add stop / start / restart
# ...maybe "reconfig" of some kind?