sync: 2026-03-16 14:00 — 26 files from Alexandria
Some checks failed
Lint & Format / detect (push) Has been cancelled
Lint & Format / js-lint (push) Has been cancelled
Lint & Format / py-lint (push) Has been cancelled
Lint & Format / sh-lint (push) Has been cancelled
Lint & Format / go-lint (push) Has been cancelled
Monorepo Lint / lint-shell (push) Has been cancelled
Monorepo Lint / lint-js (push) Has been cancelled

RoadChain-SHA2048: 4aa2baf238024b57
RoadChain-Identity: alexa@sovereign
RoadChain-Full: 4aa2baf238024b57b5f97e1fc31d99a3d06cfcc89db1b65a250fc32fa730d3afa0285c603566aa3f33aac0002106f8ab433756c110d4e34669375312d27b7df5c322e705b22bdd1bf2e73621c88acb72005cf0e01c0fe43ebda842cd3ed46b38cbe2630d19265f446313fda488510c91b7e232f7d3df04730afbeae331e23a20cec0f3a21ea0a85a16e6468db8dba9e7dfeface2b9d8a6298655fe1704f4275724d039f0dd8c46828faacd451128832415dd7cc14e9239d9db1128ec560e5fb738e186a55c39304a9b362860038cff76345a238581780ff574f1eb8904250965adc0486318106cbfd890433d1787a4a98270eec49ca0341681a8f13dba86bd43
This commit is contained in:
2026-03-16 14:00:02 -05:00
parent 41f747ccae
commit ace988587c
26 changed files with 291 additions and 311 deletions

View File

@@ -22,13 +22,38 @@ SLACK_URL="https://blackroad-slack.amundsonalexa.workers.dev"
log() { printf "[%s] %s\n" "$(date '+%Y-%m-%d %H:%M:%S')" "$1"; }
ALERT_COOLDOWN=1800 # 30 minutes between repeat alerts for same issue
ALERT_STATE_DIR="$STATE_DIR/alerts"
mkdir -p "$ALERT_STATE_DIR"
slack_alert() {
local key=$(echo "$1" | md5sum | cut -c1-12 2>/dev/null || echo "$(date +%s)")
local cooldown_file="$ALERT_STATE_DIR/$key"
# Skip if same alert was sent within cooldown period
if [[ -f "$cooldown_file" ]]; then
local last=$(cat "$cooldown_file" 2>/dev/null)
local now=$(date +%s)
if (( now - last < ALERT_COOLDOWN )); then
return 0 # Suppress duplicate
fi
fi
date +%s > "$cooldown_file"
curl -s --max-time 5 -X POST "$SLACK_URL/alert" \
-H "Content-Type: application/json" \
-d "{\"text\":\"$1\"}" >/dev/null 2>&1 || true
}
slack_post() {
local key=$(echo "$1" | md5sum | cut -c1-12 2>/dev/null || echo "$(date +%s)")
local cooldown_file="$ALERT_STATE_DIR/$key"
if [[ -f "$cooldown_file" ]]; then
local last=$(cat "$cooldown_file" 2>/dev/null)
local now=$(date +%s)
if (( now - last < ALERT_COOLDOWN )); then
return 0
fi
fi
date +%s > "$cooldown_file"
curl -s --max-time 5 -X POST "$SLACK_URL/post" \
-H "Content-Type: application/json" \
-d "{\"text\":\"$1\"}" >/dev/null 2>&1 || true