Skip to content

Commit 75760da

Browse files
committed
Script allow passing of timeout
1 parent 43459f0 commit 75760da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyres/scripts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def pyres_worker():
106106
parser.add_option('-l', '--log-level', dest='log_level', default='info', help='log level. Valid values are "debug", "info", "warning", "error", "critical", in decreasing order of verbosity. Defaults to "info" if parameter not specified.')
107107
parser.add_option('-f', dest='logfile', help='If present, a logfile will be used. "stderr", "stdout", and "syslog" are all special values.')
108108
parser.add_option('-p', dest='pidfile', help='If present, a pidfile will be used.')
109+
parser.add_option("-t", '--timeout', dest='timeout', default=None, help='the timeout in seconds for this worker')
109110
(options,args) = parser.parse_args()
110111

111112
if len(args) != 1:
@@ -120,6 +121,8 @@ def pyres_worker():
120121
if interval is not None:
121122
interval = int(interval)
122123

124+
timeout = options.timeout is None and options.timeout or int(options.timeout)
125+
123126
queues = args[0].split(',')
124127
server = '%s:%s' % (options.host,options.port)
125-
Worker.run(queues, server, interval)
128+
Worker.run(queues, server, interval, timeout=timeout)

0 commit comments

Comments
 (0)