Day page: a past date with no activity is not found, and never written to disk

Probing any old date returned an empty page with a 200 and left a junk file
behind for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-23 05:46:00 -05:00
parent 4c6fb7bed2
commit a95633c6ca
+7 -1
View File
@@ -90,7 +90,13 @@ function get(key) {
if (key > today) return null;
}
const d = compute(key);
if (d && key !== today) save(d);
if (!d) return null;
if (key !== today) {
// a past day with nothing in it is either before the contract or beyond the index's reach:
// say not found rather than serving an empty page, and never write a file for it
if (d.totals.payouts + d.totals.joins === 0) return null;
save(d);
}
return d;
}
function save(d) { try { fs.writeFileSync(dayFile(d.key), JSON.stringify(d)); } catch (e) {} }