From 8694259be7b8d943680d7d2fc848fa0fc5221fb9 Mon Sep 17 00:00:00 2001 From: tycrek Date: Sat, 3 Jul 2021 10:53:22 -0600 Subject: [PATCH] metrics now uses scripted counter --- metrics.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metrics.js b/metrics.js index eede1e5..096a40f 100644 --- a/metrics.js +++ b/metrics.js @@ -7,6 +7,7 @@ const { bucketSize } = require('./storage'); module.exports = () => { const data = fs.readJsonSync(path.join(__dirname, 'data.json')); const { users } = fs.readJsonSync(path.join(__dirname, 'auth.json')); + Object.keys(users).forEach((token) => users[token].count = 0); let totalSize = 0; let oldSize = 0; @@ -17,6 +18,7 @@ module.exports = () => { else { if (!users[token].size) users[token].size = 0; users[token].size += size; + users[token].count++; } } catch (ex) { // Silently handle missing tokens from dev environment -tycrek