mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Server: Exclude certain queries from slow log
This commit is contained in:
parent
5e8b7420ff
commit
4e70ca6fd0
@ -122,8 +122,16 @@ export function setupSlowQueryLog(connection: DbConnection, slowQueryLogMinDurat
|
||||
|
||||
const queryInfos: Record<any, QueryInfo> = {};
|
||||
|
||||
// These queries do not return a response, so "query-response" is not
|
||||
// called.
|
||||
const ignoredQueries = /^BEGIN|SAVEPOINT|RELEASE SAVEPOINT|COMMIT|ROLLBACK/gi;
|
||||
|
||||
connection.on('query', (data) => {
|
||||
const timeoutId = makeSlowQueryHandler(slowQueryLogMinDuration, connection, data.sql, data.bindings);
|
||||
const sql: string = data.sql;
|
||||
|
||||
if (!sql || sql.match(ignoredQueries)) return;
|
||||
|
||||
const timeoutId = makeSlowQueryHandler(slowQueryLogMinDuration, connection, sql, data.bindings);
|
||||
|
||||
queryInfos[data.__knexQueryUid] = {
|
||||
timeoutId,
|
||||
|
Loading…
Reference in New Issue
Block a user