From: Ben Darnell Date: Wed, 17 Nov 2010 00:37:53 +0000 (-0800) Subject: Add debug logging for queuing in simple_httpclient. X-Git-Tag: v1.2.0~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0620d67181714e1880b83b54ebafd6ba9f37666;p=thirdparty%2Ftornado.git Add debug logging for queuing in simple_httpclient. Also remove some old extremely verbose debug logging. --- diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index c1b340627..5819a0cd1 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -86,6 +86,10 @@ class SimpleAsyncHTTPClient(object): callback = stack_context.wrap(callback) self.queue.append((request, callback)) self._process_queue() + if self.queue: + logging.debug("max_clients limit reached, request queued. " + "%d active, %d queued requests." % ( + len(self.active), len(self.queue))) def _process_queue(self): with stack_context.NullContext(): @@ -191,9 +195,6 @@ class _HTTPConnection(object): req_path)] for k, v in self.request.headers.get_all(): request_lines.append("%s: %s" % (k, v)) - if logging.getLogger().isEnabledFor(logging.DEBUG): - for line in request_lines: - logging.debug(line) self.stream.write("\r\n".join(request_lines) + "\r\n\r\n") if has_body: self.stream.write(self.request.body) @@ -210,7 +211,6 @@ class _HTTPConnection(object): self.callback = None def _on_headers(self, data): - logging.debug(data) first_line, _, header_data = data.partition("\r\n") match = re.match("HTTP/1.[01] ([0-9]+) .*", first_line) assert match