mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 10:15:27 -04:00
Fix logical bugs in event bus and bulk session deletion (#3139)
This commit is contained in:
committed by
GitHub
parent
b8463e3ac2
commit
2a6921a455
@@ -543,22 +543,25 @@ def setup_session_routes(session_manager: SessionManager, config: dict, webhook_
|
||||
ids = body.get("ids", [])
|
||||
except Exception:
|
||||
ids = []
|
||||
deleted_count = 0
|
||||
for sid in ids:
|
||||
try:
|
||||
_verify_session_owner(request, sid, session_manager)
|
||||
session_manager.delete_session(sid)
|
||||
|
||||
# Enforce "starred" protection consistent with single-session delete
|
||||
db = SessionLocal()
|
||||
try:
|
||||
db.query(_CM).filter(_CM.session_id == sid).delete()
|
||||
db.query(DbSession).filter(DbSession.id == sid).delete()
|
||||
db.commit()
|
||||
except Exception:
|
||||
db.rollback()
|
||||
db_sess = db.query(DbSession).filter(DbSession.id == sid).first()
|
||||
if db_sess and db_sess.is_important:
|
||||
continue
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if session_manager.delete_session(sid):
|
||||
deleted_count += 1
|
||||
except Exception:
|
||||
pass
|
||||
return {"deleted": len(ids)}
|
||||
return {"deleted": deleted_count}
|
||||
|
||||
@router.delete("/session/{sid}")
|
||||
def delete_session(request: Request, sid: str):
|
||||
|
||||
Reference in New Issue
Block a user