Turn on gevent block logging by default
This commit is contained in:
parent
aad1a836db
commit
cc48a0ad86
2 changed files with 11 additions and 13 deletions
|
@ -179,7 +179,6 @@ class Config(object):
|
|||
self.parser.add_argument('--debug', help='Debug mode', action='store_true')
|
||||
self.parser.add_argument('--silent', help='Disable logging to terminal output', action='store_true')
|
||||
self.parser.add_argument('--debug_socket', help='Debug socket connections', action='store_true')
|
||||
self.parser.add_argument('--debug_gevent', help='Debug gevent functions', action='store_true')
|
||||
|
||||
self.parser.add_argument('--batch', help="Batch mode (No interactive input for commands)", action='store_true')
|
||||
|
||||
|
|
|
@ -46,20 +46,19 @@ def formatStack():
|
|||
|
||||
|
||||
# Test if gevent eventloop blocks
|
||||
if config.debug_gevent:
|
||||
import logging
|
||||
import gevent
|
||||
import time
|
||||
import logging
|
||||
import gevent
|
||||
import time
|
||||
|
||||
def testBlock():
|
||||
logging.debug("Gevent block checker started")
|
||||
def testBlock():
|
||||
logging.debug("Gevent block checker started")
|
||||
last_time = time.time()
|
||||
while 1:
|
||||
time.sleep(1)
|
||||
if time.time() - last_time > 1.1:
|
||||
logging.debug("Gevent block detected: %s" % (time.time() - last_time - 1))
|
||||
last_time = time.time()
|
||||
while 1:
|
||||
time.sleep(1)
|
||||
if time.time() - last_time > 1.1:
|
||||
logging.debug("Gevent block detected: %s" % (time.time() - last_time - 1))
|
||||
last_time = time.time()
|
||||
gevent.spawn(testBlock)
|
||||
gevent.spawn(testBlock)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue