Spaces:
Sleeping
Sleeping
File size: 580 Bytes
783e5b3 53a70ee 783e5b3 53a70ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import threading
import time
import asyncio
from codexmesh_stream import emit_event
class CodexMeshSync:
def __init__(self, interval=10):
self.interval = interval
self.running = True
thread = threading.Thread(target=self._heartbeat_loop, daemon=True)
thread.start()
def _heartbeat_loop(self):
while self.running:
try:
asyncio.run(emit_event("heartbeat", {
"status": "alive"
}))
except Exception:
pass
time.sleep(self.interval) |