guide: full step-by-step (reg -> shim -> channel -> all ranks -> diagnostics); probe watcher rotates keys
This commit is contained in:
@@ -12,7 +12,7 @@ import sys
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
KEYS = os.environ.get("NUMES_KEYS", "/opt/numes-shim/keys.json")
|
||||
KEYS = "/opt/numes-shim/keys.json"
|
||||
BASE = "https://api.numes.ai/api/v1"
|
||||
CHANNEL = "numes-pool"
|
||||
STATE = "/opt/numes-shim/watch_state.json"
|
||||
@@ -34,11 +34,14 @@ def log(msg):
|
||||
|
||||
|
||||
def first_key():
|
||||
"""Rotate across the key bank so one account never eats the whole probe load."""
|
||||
try:
|
||||
d = json.load(open(KEYS))
|
||||
if isinstance(d, dict):
|
||||
d = d.get("keys", [])
|
||||
return d[0] if d else None
|
||||
if not d:
|
||||
return None
|
||||
return d[int(time.time() // 600) % len(d)]
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user