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('--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('--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_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')
|
self.parser.add_argument('--batch', help="Batch mode (No interactive input for commands)", action='store_true')
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,11 @@ def formatStack():
|
||||||
|
|
||||||
|
|
||||||
# Test if gevent eventloop blocks
|
# Test if gevent eventloop blocks
|
||||||
if config.debug_gevent:
|
import logging
|
||||||
import logging
|
import gevent
|
||||||
import gevent
|
import time
|
||||||
import time
|
|
||||||
|
|
||||||
def testBlock():
|
def testBlock():
|
||||||
logging.debug("Gevent block checker started")
|
logging.debug("Gevent block checker started")
|
||||||
last_time = time.time()
|
last_time = time.time()
|
||||||
while 1:
|
while 1:
|
||||||
|
@ -59,7 +58,7 @@ if config.debug_gevent:
|
||||||
if time.time() - last_time > 1.1:
|
if time.time() - last_time > 1.1:
|
||||||
logging.debug("Gevent block detected: %s" % (time.time() - last_time - 1))
|
logging.debug("Gevent block detected: %s" % (time.time() - last_time - 1))
|
||||||
last_time = time.time()
|
last_time = time.time()
|
||||||
gevent.spawn(testBlock)
|
gevent.spawn(testBlock)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue