mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-08 11:56:59 +00:00
fix: add grace period to document tidy to prevent deleting new documents (#5036)
This commit is contained in:
@@ -78,7 +78,14 @@ async def run_document_tidy(owner: str) -> str:
|
||||
kept = 0
|
||||
survivors = [] # docs that pass the junk rules, considered for dedup
|
||||
|
||||
now = datetime.utcnow()
|
||||
|
||||
for doc in docs:
|
||||
# Skip freshly created documents to avoid deleting them while the user is actively editing
|
||||
if doc.created_at and (now - doc.created_at).total_seconds() < 900: # 15 minutes
|
||||
survivors.append(doc)
|
||||
continue
|
||||
|
||||
content = (doc.current_content or "").strip()
|
||||
title = (doc.title or "").strip().lower()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user