mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-13 12:38:02 +00:00
Merge remote-tracking branch 'origin/dev'
# Conflicts: # routes/document_routes.py
This commit is contained in:
+11
-3
@@ -6,7 +6,7 @@ Reusable document actions callable from both REST routes and the task scheduler.
|
||||
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -77,12 +77,20 @@ async def run_document_tidy(owner: str) -> str:
|
||||
deleted = 0
|
||||
kept = 0
|
||||
survivors = [] # docs that pass the junk rules, considered for dedup
|
||||
now = datetime.utcnow()
|
||||
now = datetime.now(timezone.utc)
|
||||
|
||||
for doc in docs:
|
||||
created = doc.created_at
|
||||
if created and created.tzinfo is None:
|
||||
created = created.replace(tzinfo=timezone.utc)
|
||||
|
||||
# Skip freshly created documents to avoid deleting them while the user is actively editing
|
||||
if created and (now - created).total_seconds() < 900: # 15 minutes
|
||||
survivors.append(doc)
|
||||
continue
|
||||
|
||||
content = (doc.current_content or "").strip()
|
||||
title = (doc.title or "").strip().lower()
|
||||
created = doc.created_at
|
||||
is_fresh_empty = (
|
||||
not content
|
||||
and created is not None
|
||||
|
||||
Reference in New Issue
Block a user