mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Added "time taken" info for Statistics menu
This commit is contained in:
parent
1c7bff20d9
commit
65847232c4
@ -596,6 +596,7 @@ self.stats = async (req, res, next) => {
|
||||
if (!isadmin) return res.status(403).end()
|
||||
|
||||
try {
|
||||
const hrstart = process.hrtime()
|
||||
const stats = {}
|
||||
const os = await si.osInfo()
|
||||
|
||||
@ -933,7 +934,7 @@ self.stats = async (req, res, next) => {
|
||||
statsCache.albums.generating = false
|
||||
}
|
||||
|
||||
return res.json({ success: true, stats })
|
||||
return res.json({ success: true, stats, hrtime: process.hrtime(hrstart) })
|
||||
} catch (error) {
|
||||
logger.error(error)
|
||||
// Reset generating state when encountering any errors
|
||||
|
@ -2901,6 +2901,15 @@ page.getStatistics = (params = {}) => {
|
||||
`
|
||||
}
|
||||
|
||||
if (Array.isArray(response.data.hrtime))
|
||||
content += `
|
||||
<article class="message is-size-7">
|
||||
<div class="message-body has-text-left">
|
||||
Time taken: ${response.data.hrtime[0]}s ${Math.ceil(response.data.hrtime[1] / 1000000)}ms.
|
||||
</div>
|
||||
</article>
|
||||
`
|
||||
|
||||
page.dom.innerHTML = content
|
||||
page.fadeAndScroll()
|
||||
page.updateTrigger(params.trigger, 'active')
|
||||
|
Loading…
Reference in New Issue
Block a user