mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Merge branch 'django1.8' into django1.9
* django1.8: Fixing missing DB logs (redis and mongo) due to this change in django 1.8: "connections.queries is now a read-only attribute." Removing migrations that set a default date of 2020-05-08. Not sure why this was committed. I thought we resolved the issue with default datetimes?
This commit is contained in:
commit
ecadf77a22
3 changed files with 8 additions and 2 deletions
|
@ -106,6 +106,8 @@ class SQLLogToConsoleMiddleware:
|
||||||
if connection.queries:
|
if connection.queries:
|
||||||
time_elapsed = sum([float(q['time']) for q in connection.queries])
|
time_elapsed = sum([float(q['time']) for q in connection.queries])
|
||||||
queries = connection.queries
|
queries = connection.queries
|
||||||
|
if getattr(connection, 'queriesx', False):
|
||||||
|
queries.extend(connection.queriesx)
|
||||||
for query in queries:
|
for query in queries:
|
||||||
if query.get('mongo'):
|
if query.get('mongo'):
|
||||||
query['sql'] = "~FM%s: %s" % (query['mongo']['collection'], query['mongo']['query'])
|
query['sql'] = "~FM%s: %s" % (query['mongo']['collection'], query['mongo']['query'])
|
||||||
|
|
|
@ -63,7 +63,9 @@ class MongoDumpMiddleware(object):
|
||||||
result = original_method(*args, **kwargs)
|
result = original_method(*args, **kwargs)
|
||||||
stop = time()
|
stop = time()
|
||||||
duration = stop - start
|
duration = stop - start
|
||||||
connection.queries.append({
|
if not getattr(connection, 'queriesx', False):
|
||||||
|
connection.queriesx = []
|
||||||
|
connection.queriesx.append({
|
||||||
'mongo': message,
|
'mongo': message,
|
||||||
'time': '%.3f' % duration,
|
'time': '%.3f' % duration,
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,7 +39,9 @@ class RedisDumpMiddleware(object):
|
||||||
result = original_method(*args, **kwargs)
|
result = original_method(*args, **kwargs)
|
||||||
stop = time()
|
stop = time()
|
||||||
duration = stop - start
|
duration = stop - start
|
||||||
connection.queries.append({
|
if not getattr(connection, 'queriesx', False):
|
||||||
|
connection.queriesx = []
|
||||||
|
connection.queriesx.append({
|
||||||
'redis': message,
|
'redis': message,
|
||||||
'time': '%.3f' % duration,
|
'time': '%.3f' % duration,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue