mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Make the timeout for event queue checks configurable.
Now defaults xmlstream.WAIT_TIMEOUT, and settable with self.wait_timeout. The new default timeout is 1sec instead of 5sec.
This commit is contained in:
parent
fe6bc31c60
commit
802dd8393d
1 changed files with 7 additions and 1 deletions
|
@ -47,6 +47,10 @@ else:
|
||||||
# The time in seconds to wait before timing out waiting for response stanzas.
|
# The time in seconds to wait before timing out waiting for response stanzas.
|
||||||
RESPONSE_TIMEOUT = 30
|
RESPONSE_TIMEOUT = 30
|
||||||
|
|
||||||
|
# The time in seconds to wait for events from the event queue, and also the
|
||||||
|
# time between checks for the process stop signal.
|
||||||
|
WAIT_TIMEOUT = 1
|
||||||
|
|
||||||
# The number of threads to use to handle XML stream events. This is not the
|
# The number of threads to use to handle XML stream events. This is not the
|
||||||
# same as the number of custom event handling threads. HANDLER_THREADS must
|
# same as the number of custom event handling threads. HANDLER_THREADS must
|
||||||
# be at least 1.
|
# be at least 1.
|
||||||
|
@ -178,6 +182,7 @@ class XMLStream(object):
|
||||||
self.ssl_version = ssl.PROTOCOL_TLSv1
|
self.ssl_version = ssl.PROTOCOL_TLSv1
|
||||||
self.ca_certs = None
|
self.ca_certs = None
|
||||||
|
|
||||||
|
self.wait_timeout = WAIT_TIMEOUT
|
||||||
self.response_timeout = RESPONSE_TIMEOUT
|
self.response_timeout = RESPONSE_TIMEOUT
|
||||||
self.reconnect_delay = None
|
self.reconnect_delay = None
|
||||||
self.reconnect_max_delay = RECONNECT_MAX_DELAY
|
self.reconnect_max_delay = RECONNECT_MAX_DELAY
|
||||||
|
@ -1210,7 +1215,8 @@ class XMLStream(object):
|
||||||
try:
|
try:
|
||||||
while not self.stop.isSet():
|
while not self.stop.isSet():
|
||||||
try:
|
try:
|
||||||
event = self.event_queue.get(True, timeout=5)
|
wait = self.wait_timeout
|
||||||
|
event = self.event_queue.get(True, timeout=wait)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
event = None
|
event = None
|
||||||
if event is None:
|
if event is None:
|
||||||
|
|
Loading…
Reference in a new issue