Commit 8e6500e2 authored by Yusei Tahara's avatar Yusei Tahara

cli/slapgrid: Create slapgrid object after checking pidfile.

Slapgrid object makes a connection to master node immediately,
thus if you create a slapgrid object without checking pidfile and if
master node responds very slowly, you may get tons of stucked slapgrid
processes by cron and system may become unusable.
parent 233394db
Pipeline #29464 failed with stage
in 0 seconds
......@@ -109,14 +109,16 @@ class SlapgridCommand(ConfigCommand):
random_delay(options, logger=self.app.log)
slapgrid_object = create_slapgrid_object(options, logger=self.app.log)
pidfile = ( options.get(self.pidfile_option_name) or
options.get('pidfile') or # for compatibility we also read pidfile from option `pidfile`
self.default_pidfile )
if pidfile:
setRunning(logger=self.app.log, pidfile=pidfile)
# Create slapgrid object after checking pidfile.
slapgrid_object = create_slapgrid_object(options, logger=self.app.log)
try:
return getattr(slapgrid_object, self.method_name)()
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment