Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config to manage how long logs are stored #3257

Merged
merged 9 commits into from Nov 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Optimize deleting logs
  • Loading branch information
Cordila authored and Cordila committed Mar 14, 2023
commit c34a9ed94760b880746135f30ca6def0c9194859
3 changes: 1 addition & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,8 +1736,7 @@ async def log_expiry(self):
next_expiry = closed_at + log_expire_after
return await discord.utils.sleep_until(next_expiry)

for log in expired_logs:
await self.db.logs.delete_one({"_id": log["_id"]})
await self.db.logs.delete_many({"closed_at": {"$lte": str(expiration_datetime)}})
This conversation was marked as resolved.
Show resolved Hide resolved
logger.info(f"Deleted {len(expired_logs)} expired logs.")

fetch = await self.db.logs.find().sort("closed_at", 1).limit(1).to_list(None)
Expand Down