metrics now uses scripted counter

pull/22/head
tycrek 4 years ago
parent cd17818b64
commit 8694259be7
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -7,6 +7,7 @@ const { bucketSize } = require('./storage');
module.exports = () => { module.exports = () => {
const data = fs.readJsonSync(path.join(__dirname, 'data.json')); const data = fs.readJsonSync(path.join(__dirname, 'data.json'));
const { users } = fs.readJsonSync(path.join(__dirname, 'auth.json')); const { users } = fs.readJsonSync(path.join(__dirname, 'auth.json'));
Object.keys(users).forEach((token) => users[token].count = 0);
let totalSize = 0; let totalSize = 0;
let oldSize = 0; let oldSize = 0;
@ -17,6 +18,7 @@ module.exports = () => {
else { else {
if (!users[token].size) users[token].size = 0; if (!users[token].size) users[token].size = 0;
users[token].size += size; users[token].size += size;
users[token].count++;
} }
} catch (ex) { } catch (ex) {
// Silently handle missing tokens from dev environment -tycrek // Silently handle missing tokens from dev environment -tycrek

Loading…
Cancel
Save