From 26fc3a196632bb544e17994a4f95081454d21045 Mon Sep 17 00:00:00 2001 From: mikiher Date: Sat, 25 Nov 2023 08:14:45 +0200 Subject: [PATCH] Remove currently unused time measurement utils --- server/utils/timing.js | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 server/utils/timing.js diff --git a/server/utils/timing.js b/server/utils/timing.js deleted file mode 100644 index 6945a706..00000000 --- a/server/utils/timing.js +++ /dev/null @@ -1,26 +0,0 @@ -const { performance } = require('perf_hooks') -const Logger = require('../Logger') - -async function measure(tag, func) { - const start = performance.now() - const result = await func() - const end = performance.now() - Logger.debug(`[${tag}] Time elapsed: ${(end - start) | 0} ms`) - return result -} - -function measureMiddleware(req, res, next) { - const start = performance.now() - res.on('finish', () => { - const end = performance.now() - if (!req.originalUrl.includes('cover')) - Logger.debug(`[${req.method} ${req.originalUrl}] Finish: Time elapsed: ${(end - start) | 0} ms`) - }) - res.on('close', () => { - const end = performance.now() - if (!req.originalUrl.includes('cover')) - Logger.debug(`[${req.method} ${req.originalUrl}] Close: Time elapsed: ${(end - start) | 0} ms`) - }) - next() -} -module.exports = { measure, measureMiddleware } \ No newline at end of file