From 6b8d57ec3fd48e9e953e23e9e1db8eb41e0870f9 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 8 Feb 2023 17:57:03 +0200 Subject: [PATCH] chore: Remove unused ietf/secr/middleware/dbquery.py (#5109) Fixes #4303 --- ietf/secr/middleware/dbquery.py | 35 --------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 ietf/secr/middleware/dbquery.py diff --git a/ietf/secr/middleware/dbquery.py b/ietf/secr/middleware/dbquery.py deleted file mode 100644 index 34c96bd12b..0000000000 --- a/ietf/secr/middleware/dbquery.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright The IETF Trust 2014-2019, All Rights Reserved -#import logging - -from django.db import connection -from django.utils.log import getLogger # type: ignore - - -logger = getLogger(__name__) -#logger.setLevel(logging.DEBUG) -#logger.addHandler(logging.FileHandler(settings.SECR_LOG_FILE)) - -class QueryCountDebugMiddleware(object): - """ - This middleware will log the number of queries run - and the total time taken for each request (with a - status code of 200). It does not currently support - multi-db setups. - """ - def process_response(self, request, response): - #assert False, request.path - logger.debug('called middleware. %s:%s' % (request.path,len(connection.queries))) - if response.status_code == 200: - total_time = 0 - #for query in connection.queries: - # query_time = query.get('time') - # if query_time is None: - # django-debug-toolbar monkeypatches the connection - # cursor wrapper and adds extra information in each - # item in connection.queries. The query time is stored - # under the key "duration" rather than "time" and is - # in milliseconds, not seconds. - # query_time = query.get('duration', 0) / 1000 - # total_time += float(query_time) - logger.debug('%s: %s queries run, total %s seconds' % (request.path,len(connection.queries), total_time)) - return response