Commit a8cd74dd authored by Paul Rich's avatar Paul Rich

Lowering minimum event trigger time to 0.01 sec.

parent 7361af59
......@@ -55,7 +55,7 @@ def state_file_location():
def run_component (component_cls, argv=None, register=True, state_name=False,
cls_kwargs={}, extra_getopt='', time_out=10.0,
single_threaded=False, seq_num=0, aug_comp_name=False,
state_name_match_component=False, sleeptime=10.0):
state_name_match_component=False, sleeptime=0.01):
'''Run the specified Cobalt component until recieving signal to terminate.
Args::
......@@ -172,8 +172,8 @@ def run_component (component_cls, argv=None, register=True, state_name=False,
if single_threaded:
# sleeptime is not used due to differences in api.
server = BaseXMLRPCServer(location, keyfile=keypath, certfile=certpath,
cafile=capath, register=register, timeout=time_out)
server = BaseXMLRPCServer(location, keyfile=keypath, certfile=certpath,
cafile=capath, register=register, timeout=time_out, sleeptime=sleeptime)
else:
server = XMLRPCServer(location, keyfile=keypath, certfile=certpath,
cafile=capath, register=register, timeout=time_out, sleeptime=sleeptime)
......
......@@ -314,7 +314,8 @@ class BaseXMLRPCServer (SSLServer, CobaltXMLRPCDispatcher, object):
keyfile=None, certfile=None,
timeout=10,
logRequests=False,
register=True, allow_none=True, encoding=None, cafile=None):
register=True, allow_none=True, encoding=None, cafile=None,
sleeptime=0.01):
"""Initialize the XML-RPC server.
......@@ -347,6 +348,7 @@ class BaseXMLRPCServer (SSLServer, CobaltXMLRPCDispatcher, object):
self.register_function(self.ping)
self.logger.info("service available at %s" % self.url)
self.timeout = timeout
self.sleeptime=sleeptime
def register_instance (self, instance, *args, **kwargs):
......@@ -410,7 +412,7 @@ class BaseXMLRPCServer (SSLServer, CobaltXMLRPCDispatcher, object):
except:
self.logger.error("Unexpected task failure", exc_info=1)
# this causes delays such as in control-c
Cobalt.Util.sleep(self.timeout)
Cobalt.Util.sleep(self.sleeptime)
except:
self.logger.error("tasks_thread failed", exc_info=1)
......@@ -497,8 +499,7 @@ class XMLRPCServer (SocketServer.ThreadingMixIn, BaseXMLRPCServer):
BaseXMLRPCServer.__init__(self, server_address, RequestHandlerClass, keyfile,
certfile, timeout, logRequests, register, allow_none, encoding, cafile=cafile,
)
self.sleeptime=sleeptime
sleeptime=sleeptime)
self.task_thread = threading.Thread(target=self._tasks_thread)
#FIXME: this will fail if a get is called before self._register is defined
......
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