with autoclean
This commit is contained in:
parent
540a3cc884
commit
55a6ddb819
4 changed files with 54 additions and 1 deletions
15
main.py
15
main.py
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
import asyncio
|
||||
from playwright.async_api import async_playwright
|
||||
from application_handler import ApplicationHandler
|
||||
|
|
@ -9,6 +10,7 @@ import os
|
|||
from dotenv import load_dotenv
|
||||
from state_manager import StateManager
|
||||
from pathlib import Path
|
||||
from autoclean_debug import autoclean_debug_material
|
||||
|
||||
|
||||
# --- Environment & Logging Setup ---
|
||||
|
|
@ -70,7 +72,20 @@ async def main():
|
|||
|
||||
try:
|
||||
logger.info(f"Bot is now running. Refreshing every {CHECK_INTERVAL} seconds...")
|
||||
last_clean = 0
|
||||
CLEAN_INTERVAL = 48 * 3600 # 48 hours in seconds
|
||||
while True:
|
||||
now = asyncio.get_event_loop().time()
|
||||
# Autoclean debug material every 48 hours
|
||||
if now - last_clean > CLEAN_INTERVAL:
|
||||
logger.info("Running autoclean_debug_material (48h interval)...")
|
||||
try:
|
||||
deleted = autoclean_debug_material()
|
||||
logger.info(f"Autocleaned {len(deleted)} debug files.")
|
||||
except Exception as e:
|
||||
logger.warning(f"Autoclean failed: {e}")
|
||||
last_clean = now
|
||||
|
||||
current_listings = await app_handler.fetch_listings()
|
||||
if not current_listings:
|
||||
logger.warning("No listings fetched")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue