Compare commits

..

No commits in common. "d9ee874f512133fc6387e437ac250bccf5b8a6a5" and "2c82f972bf4fa0c9b6ab8b9895033e496af5ea7e" have entirely different histories.

View File

@ -30,7 +30,7 @@ class NeoSessionManager:
self._db = TinyDB(db_path)
self._table = self._db.table("sessions")
def create(self, name: str, model_info: dict, max_retries: int = 5) -> NeoSession:
def create(self, name: str, model_info: dict) -> NeoSession:
now = datetime.now(timezone.utc).isoformat()
doc = {
"session_id": str(uuid.uuid4()),
@ -40,24 +40,8 @@ class NeoSessionManager:
"model_info": model_info,
"messages": [],
}
import time
import random
for attempt in range(max_retries):
try:
doc_id = self._table.insert(doc)
return self._doc_to_session(self._table.get(doc_id=doc_id))
except ValueError:
if attempt < max_retries - 1:
# Exponential backoff dengan jitter
wait_time = (0.1 * (2 ** attempt)) + random.uniform(0, 0.05)
time.sleep(wait_time)
# Reload DB untuk sinkronisasi
self._db = TinyDB(self._db._root._path)
self._table = self._db.table("sessions")
else:
raise
def list(self) -> list[dict]:
results = []