[object Object]

← back to La Socrata Ingester

yoloforever c1: disk-space preflight in run-refresh.sh (skip+CNCP note below 10G floor) — Cody FIX-FIRST, prevents ENOSPC PG crash at 04:30 on the 96%-full disk

da8cbba1d54d5b42e062471167324d840cde4b00 · 2026-08-12 10:05:51 -0700 · Steve Abrams

Files touched

Diff

commit da8cbba1d54d5b42e062471167324d840cde4b00
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Aug 12 10:05:51 2026 -0700

    yoloforever c1: disk-space preflight in run-refresh.sh (skip+CNCP note below 10G floor) — Cody FIX-FIRST, prevents ENOSPC PG crash at 04:30 on the 96%-full disk
---
 scripts/run-refresh.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/scripts/run-refresh.sh b/scripts/run-refresh.sh
index f9e0cfd..3972226 100755
--- a/scripts/run-refresh.sh
+++ b/scripts/run-refresh.sh
@@ -17,6 +17,19 @@ if [ -f "$LOG" ] && [ "$(stat -f%z "$LOG")" -gt "$MAXBYTES" ]; then
   mv -f "$LOG" "$LOG.1"
 fi
 
-echo "=== [$(date '+%Y-%m-%d %H:%M:%S')] refresh cycle start ===" >> "$LOG"
+# disk preflight — NEVER ingest into Postgres on a near-full disk. An incremental `all`
+# writes to PG; at ENOSPC, PG crashes (the kamatera-disk-growth precedent). Fail LOUD +
+# clean (skip + CNCP note) so the canary/watchdog see a healthy skip, not a PG crash.
+MIN_FREE_GB="${MIN_FREE_GB:-10}"
+AVAIL_GB=$(( $(df -k . | awk 'NR==2{print $4}') / 1024 / 1024 ))
+if [ "$AVAIL_GB" -lt "$MIN_FREE_GB" ]; then
+  MSG="[LA REFRESH SKIPPED $(date +%F)] disk ${AVAIL_GB}G free < ${MIN_FREE_GB}G floor — skipped ingest to avoid an ENOSPC Postgres crash. Free space, then the next 04:30 run resumes."
+  echo "$MSG" >> "$LOG"
+  curl -sS --max-time 8 "${CNCP_URL:-http://localhost:3333}/api/parking-lot" -H 'Content-Type: application/json' \
+    -d "$(jq -n --arg u "file://$PWD" --arg note "$MSG" '{url:$u, note:$note}')" >/dev/null 2>&1 || true
+  exit 0
+fi
+
+echo "=== [$(date '+%Y-%m-%d %H:%M:%S')] refresh cycle start (disk ${AVAIL_GB}G free) ===" >> "$LOG"
 "$NODE" src/cli.js all "$@" >> "$LOG" 2>&1
 echo "=== [$(date '+%Y-%m-%d %H:%M:%S')] refresh cycle done (\$0) ===" >> "$LOG"

← 298f4ef li-search: multi-engine rotation + bing/mojeek (built; PAUSE  ·  back to La Socrata Ingester  ·  add targeted openclaw LinkedIn tool (real-browser Google; si 258fd0a →