mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Remove currently unused time measurement utils
This commit is contained in:
parent
ab19e25586
commit
26fc3a1966
@ -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 }
|
Loading…
Reference in New Issue
Block a user