Snapshot: account counts from the JSON account store when MySQL is off (production LinkSpin), so sign-ups, wallets and payouts-on are real numbers, not zeros

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-02 08:29:37 -06:00
parent d22b8adada
commit 8dbac9379f
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -724,7 +724,7 @@ async function boot() {
domains.init({ dataDir: DATA_DIR, siteConfig, saveSite: patch => fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(siteConfig(), patch), null, 2)),
notify: async text => { const sc = siteConfig(); if (sc.telegramBotToken && sc.telegramAdminChatId) await telegramSend(sc.telegramAdminChatId, text); else if (ADMIN_EMAIL && mailer.hasKey()) await mailer.send(ADMIN_EMAIL, 'LinkSpin: link domain burned', text.replace(/<[^>]+>/g, '')); } });
zonereport.init({ dataDir: DATA_DIR });
snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, rotator, bannerspin, zones, pages, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } });
snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, accounts, rotator, bannerspin, zones, pages, send: async (c, t, th) => { await telegramSend(c, t, th); return true; } });
setInterval(() => snapshot.tick().catch(e => console.error('snapshot', e.message)), 10 * 60 * 1000);
tank.init({ dataDir: DATA_DIR, chain, accounts, messages, mailer, site: SITE_URL, follow, store: followStore,
// network alignment + activation hold + 24-hour safety net (2026-10-27): a tank member's plain activation is never
+5
View File
@@ -26,6 +26,11 @@ async function gather(now = Date.now()) {
const q = (a, b) => X.db.q(a, b || []);
const a = (await q('SELECT COUNT(*) total, SUM(created>=?) s24, SUM(created>=? AND created<?) sPrior, SUM(address IS NOT NULL) wallet, SUM(member_id>0) payouts, SUM(last_seen>=?) seen FROM accounts', [since, prior, since, since]))[0] || {};
s.members = Number(a.total || 0); s.signups = Number(a.s24 || 0); s.signupsPrior = Number(a.sPrior || 0); s.wallets = Number(a.wallet || 0); s.payoutsOn = Number(a.payouts || 0); s.seen24h = Number(a.seen || 0);
} else if (X.accounts && X.accounts.listAll) {
// JSON store (production LinkSpin runs without MySQL): the same counts from the account records
const all = await X.accounts.listAll(1e6);
s.members = all.length; s.signups = all.filter(a => (a.created || 0) >= since).length; s.signupsPrior = all.filter(a => (a.created || 0) >= prior && (a.created || 0) < since).length;
s.wallets = all.filter(a => a.address).length; s.payoutsOn = all.filter(a => Number(a.memberId) > 0).length; s.seen24h = all.filter(a => (a.lastSeen || 0) >= since).length;
}
try {
for (const ev of X.chain.recentEvents(1e9)) {