NOC ARP auto-heal for .242/.243, per-site Gitea repos updated
This commit is contained in:
@@ -98,7 +98,7 @@ TITLE: {title}
|
||||
FIRST 300 CHARS: {excerpt}
|
||||
|
||||
Return JSON: {{"seo_title": "55-65 char SEO title with keyword", "seo_description": "150-160 char compelling description", "keywords": ["keyword1", "keyword2", ...]}}""",
|
||||
model="qwen3.5:4b", temperature=0.3)
|
||||
model="qwen3.5:4b-mlx", temperature=0.3)
|
||||
|
||||
# Convert MD to HTML (basic)
|
||||
html = _md_to_html(draft)
|
||||
|
||||
@@ -29,24 +29,40 @@ def probe(vertical, info):
|
||||
color=info["color"], alive=False, articles=0, views=0, today=0,
|
||||
subs=0, latency=0, arts=[], error=None)
|
||||
try:
|
||||
# Pre-flush ARP for known problematic IPs
|
||||
if info["ip"] in ("10.30.20.242", "10.30.20.243"):
|
||||
os.system(f"sudo arp -d {info['ip']} 2>/dev/null")
|
||||
t0 = time.time()
|
||||
r = requests.get(f"http://{info['ip']}:80/health", timeout=5)
|
||||
s["latency"] = round((time.time() - t0) * 1000)
|
||||
if r.status_code == 200:
|
||||
s["alive"] = True
|
||||
s["articles"] = r.json().get("articles", 0)
|
||||
except Exception as e:
|
||||
s["error"] = str(e)[:50]
|
||||
# Stale ARP auto-fix for problematic CTs
|
||||
if info["ip"] in ("10.30.20.242", "10.30.20.243"):
|
||||
os.system(f"sudo arp -d {info['ip']} 2>/dev/null")
|
||||
return vertical, s
|
||||
|
||||
try:
|
||||
r2 = requests.get(f"http://{info['ip']}:80/api/stats", timeout=5)
|
||||
if r2.status_code == 200:
|
||||
d = r2.json()
|
||||
s["views"] = d.get("total_views", 0)
|
||||
s["today"] = d.get("today_views", 0)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
r3 = requests.get(f"http://{info['ip']}:80/api/articles?limit=3", timeout=5)
|
||||
if r3.status_code == 200:
|
||||
s["arts"] = [{"t": a.get("title", "")[:65], "s": a.get("slug", ""),
|
||||
"d": (a.get("published_at") or "")[:10], "w": a.get("word_count", 0)}
|
||||
for a in r3.json()[:3]]
|
||||
except Exception as e:
|
||||
s["error"] = str(e)[:50]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return vertical, s
|
||||
|
||||
def refresh():
|
||||
|
||||
Reference in New Issue
Block a user