fix: round down system uptime

invalidate system info cache quicker (1s to 0.5s)
This commit is contained in:
Bobby 2021-09-08 00:46:08 +07:00
parent 4f0d49dee6
commit e31af2d267
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09

View File

@ -673,8 +673,8 @@ self.stats = async (req, res, next) => {
if (!data.cache && data.generating) {
stats[data.title] = false
} else if (((Date.now() - data.generatedAt) <= 1000) || data.generating) {
// Use cache for 1000 ms (1 second)
} else if (((Date.now() - data.generatedAt) <= 500) || data.generating) {
// Use cache for 500 ms (0.5 seconds)
stats[data.title] = data.cache
} else {
data.generating = true
@ -713,7 +713,7 @@ self.stats = async (req, res, next) => {
type: 'byte'
},
'System Uptime': {
value: time.uptime,
value: Math.floor(time.uptime),
type: 'uptime'
},
'Node.js': `${process.versions.node}`,