[WORKER] Added a gearman-poll argument

Fixes: bug #1193482

Change-Id: Ic5fc3730fba92bc6f500f0f17b78a472f5440ee5
This commit is contained in:
marcrp
2013-07-25 17:43:39 -04:00
parent d4b3b05063
commit 2afff5c98f
4 changed files with 12 additions and 1 deletions

View File

@@ -59,6 +59,11 @@ Command Line Options
The number of seconds to sleep between statistics polling of the The number of seconds to sleep between statistics polling of the
load balancer driver. Default is 300 seconds. load balancer driver. Default is 300 seconds.
.. option:: --gearman-poll <SECONDS>
The number of seconds gearman will poll before re-shuffling its
connections. Default is 60 seconds.
.. option:: --syslog .. option:: --syslog
Send log events to syslog. Send log events to syslog.

View File

@@ -29,6 +29,7 @@ group = libra
driver = haproxy driver = haproxy
reconnect_sleep = 60 reconnect_sleep = 60
stats_poll = 300 stats_poll = 300
gearman_poll = 60
server = 10.0.0.1:8080 10.0.0.2:8080 server = 10.0.0.1:8080 10.0.0.2:8080
pid = /var/run/libra/libra_worker.pid pid = /var/run/libra/libra_worker.pid
logfile = /var/log/libra/libra_worker.log logfile = /var/log/libra/libra_worker.log

View File

@@ -101,6 +101,11 @@ def main():
'--stats-poll', dest='stats_poll', type=int, metavar='TIME', '--stats-poll', dest='stats_poll', type=int, metavar='TIME',
default=300, help='statistics polling interval in seconds' default=300, help='statistics polling interval in seconds'
) )
options.parser.add_argument(
'--gearman-poll',
dest='gearman_poll', type=int, metavar='TIME',
default=60, help='Gearman worker polling timeout'
)
args = options.run() args = options.run()
if not args.server: if not args.server:

View File

@@ -85,7 +85,7 @@ def config_thread(logger, driver, args):
while (retry): while (retry):
try: try:
worker.work() worker.work(args.gearman_poll)
except KeyboardInterrupt: except KeyboardInterrupt:
retry = False retry = False
except gearman.errors.ServerUnavailable: except gearman.errors.ServerUnavailable: