8cea7dee20
- SiteForge Enterprise V8.10.0-dev.1 upstream source (210 tests) - Fix: v8_workflows._mapped_input now reads both 类型/分类 columns so WXR imports keep post/product types instead of collapsing to page - Docs: trade-pro theme port spec (R3) and implementation plan Co-Authored-By: Claude Code <noreply@anthropic.com>
19 lines
572 B
Python
19 lines
572 B
Python
"""Docker worker liveness probe: no localhost Web dependency."""
|
|
import os
|
|
import time
|
|
from pathlib import Path
|
|
from . import db
|
|
|
|
def healthy(path=None, max_age=None):
|
|
file=Path(path) if path is not None else db.DATA/'worker-heartbeat'
|
|
limit=float(max_age if max_age is not None else os.getenv('SITEFORGE_WORKER_HEALTH_MAX_AGE','45'))
|
|
if limit <= 0:return False
|
|
try:
|
|
age=time.time()-file.stat().st_mtime
|
|
return -5 <= age < limit
|
|
except OSError:
|
|
return False
|
|
|
|
if __name__=='__main__':
|
|
raise SystemExit(0 if healthy() else 1)
|