mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
Created a new constants.py file to store the REACTIONS dictionary
Updated all files to import REACTIONS from constants.py instead of reactions.py: queue_processor.py message_handler.py reactions.py (now only contains reaction handling functions) events.py (now imports REACTIONS from constants.py and handle_archived_reaction from reactions.py) core.py queue_handler.py processor/init.py
This commit is contained in:
@@ -7,7 +7,7 @@ import discord
|
||||
from typing import Dict, Optional, Tuple, Any
|
||||
from datetime import datetime
|
||||
|
||||
from .reactions import REACTIONS
|
||||
from .constants import REACTIONS
|
||||
from .progress_tracker import ProgressTracker
|
||||
|
||||
logger = logging.getLogger("VideoArchiver")
|
||||
@@ -305,3 +305,14 @@ class QueueHandler:
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to update download progress reaction: {e}")
|
||||
|
||||
def is_healthy(self) -> bool:
|
||||
"""Check if handler is healthy"""
|
||||
# Check if any downloads are stuck
|
||||
current_time = datetime.utcnow()
|
||||
for url, task in self._active_downloads.items():
|
||||
if not task.done() and task.get_coro().cr_frame.f_locals.get('start_time'):
|
||||
start_time = task.get_coro().cr_frame.f_locals['start_time']
|
||||
if (current_time - start_time).total_seconds() > 3600: # 1 hour timeout
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user