mirror of
https://github.com/jaxperro/winning-wallet-finder.git
synced 2026-07-28 00:07:47 +00:00
recorder: never delete un-ingested tape — warn from 80%, single-oldest drop only at 95% as loud last resort (user directive); volume 10→25GB
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+16
-7
@@ -63,16 +63,25 @@ class Tape:
|
|||||||
os.remove(plain)
|
os.remove(plain)
|
||||||
log(f"rotated {fam}_{cur[0]} ({cur[2]} rows)")
|
log(f"rotated {fam}_{cur[0]} ({cur[2]} rows)")
|
||||||
self.files[fam] = [hour, open(os.path.join(DIR, f"{fam}_{hour}.jsonl"), "a"), 0]
|
self.files[fam] = [hour, open(os.path.join(DIR, f"{fam}_{hour}.jsonl"), "a"), 0]
|
||||||
# disk guard: drop oldest closed segments past 85% usage
|
# disk policy (user directive 2026-07-19): NEVER delete tape the Mac
|
||||||
|
# hasn't downloaded — only the nightly ingest deletes, post-verified
|
||||||
|
# insert. The 25GB volume holds ~5 weeks un-pulled. Warn from 80%;
|
||||||
|
# only at >=95% (weeks of no ingest, disk about to kill the CURRENT
|
||||||
|
# tape too) drop the single oldest segment per rotation, loudly —
|
||||||
|
# losing the oldest hour beats the recorder crashing on a full disk
|
||||||
|
# and losing everything forward.
|
||||||
try:
|
try:
|
||||||
st = os.statvfs(DIR)
|
st = os.statvfs(DIR)
|
||||||
while st.f_bavail / st.f_blocks < 0.15:
|
free = st.f_bavail / st.f_blocks
|
||||||
|
if free < 0.20:
|
||||||
|
log(f"⚠ tape volume {100*(1-free):.0f}% full — ingest has not "
|
||||||
|
"run in a long while; check the Mac / daily pipeline")
|
||||||
|
if free < 0.05:
|
||||||
old = sorted(f for f in os.listdir(DIR) if f.endswith(".gz"))
|
old = sorted(f for f in os.listdir(DIR) if f.endswith(".gz"))
|
||||||
if not old:
|
if old:
|
||||||
break
|
os.remove(os.path.join(DIR, old[0]))
|
||||||
os.remove(os.path.join(DIR, old[0]))
|
log(f"⚠⚠ TAPE LOSS: disk full — dropped oldest segment "
|
||||||
log(f"disk guard dropped {old[0]}")
|
f"{old[0]} (last resort; fix the ingest!)")
|
||||||
st = os.statvfs(DIR)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user