fix: min to days

This commit is contained in:
chinu0609 2025-11-06 23:00:56 +05:30
parent c5f0c4af87
commit fdf037b3d0

View file

@ -23,7 +23,7 @@ logger = get_logger(__name__)
async def cleanup_unused_data( async def cleanup_unused_data(
minutes_threshold: int = 30, days_threshold: Optional[int],
dry_run: bool = True, dry_run: bool = True,
user_id: Optional[UUID] = None, user_id: Optional[UUID] = None,
text_doc: bool = False text_doc: bool = False
@ -33,8 +33,8 @@ async def cleanup_unused_data(
Parameters Parameters
---------- ----------
minutes_threshold : int days_threshold : int
Minutes since last access to consider data unused (default: 30) days since last access to consider data unused
dry_run : bool dry_run : bool
If True, only report what would be deleted without actually deleting (default: True) If True, only report what would be deleted without actually deleting (default: True)
user_id : UUID, optional user_id : UUID, optional
@ -50,14 +50,14 @@ async def cleanup_unused_data(
""" """
logger.info( logger.info(
"Starting cleanup task", "Starting cleanup task",
minutes_threshold=minutes_threshold, days_threshold=days_threshold,
dry_run=dry_run, dry_run=dry_run,
user_id=str(user_id) if user_id else None, user_id=str(user_id) if user_id else None,
text_doc=text_doc text_doc=text_doc
) )
# Calculate cutoff timestamp # Calculate cutoff timestamp
cutoff_date = datetime.now(timezone.utc) - timedelta(minutes=minutes_threshold) cutoff_date = datetime.now(timezone.utc) - timedelta(days=days_threshold)
if text_doc: if text_doc:
# SQL-based approach: Find unused TextDocuments and use cognee.delete() # SQL-based approach: Find unused TextDocuments and use cognee.delete()