/stats?all=true

This commit is contained in:
Klemek
2021-04-06 09:58:51 +02:00
parent c3e53c7df8
commit 8a9b9cdcfe
4 changed files with 133 additions and 62 deletions
+3 -1
View File
@@ -42,13 +42,15 @@ module.exports = (config, onConnect, onError) => {
const read = (path, cb) => {
if (!client.connected) {
cb({
path: path,
hits: 0,
total_visitors: 0,
current_visitors: 0,
current_visitors: cleanVisitors(path),
});
} else {
client.hgetall(path, (_, value) => {
cb({
path: path,
hits: value ? parseInt(value.h) || 0 : 0,
total_visitors: value ? parseInt(value.v) || 0 : 0,
current_visitors: cleanVisitors(path),