Insta geht wieder, wegen dem Domain Umzug
Dieser Commit ist enthalten in:
@ -15,6 +15,7 @@ from email.header import decode_header
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from utils.text_similarity import TextSimilarity
|
||||
from config.paths import PathConfig
|
||||
|
||||
logger = logging.getLogger("email_handler")
|
||||
|
||||
@ -22,8 +23,8 @@ class EmailHandler:
|
||||
"""
|
||||
Handler für den Zugriff auf E-Mail-Dienste und den Abruf von Bestätigungscodes.
|
||||
"""
|
||||
|
||||
CONFIG_FILE = os.path.join("config", "email_config.json")
|
||||
|
||||
CONFIG_FILE = os.path.join(PathConfig.CONFIG_DIR, "email_config.json")
|
||||
|
||||
def __init__(self):
|
||||
"""Initialisiert den EmailHandler und lädt die Konfiguration."""
|
||||
|
||||
@ -31,6 +31,7 @@ class ProcessGuard:
|
||||
# Konfiguration
|
||||
MAX_FAILURES = 3
|
||||
PAUSE_DURATION_HOURS = 1
|
||||
LOCK_TIMEOUT_MINUTES = 10 # Auto-Unlock nach 10 Minuten bei hängenden Prozessen
|
||||
|
||||
def __init__(self):
|
||||
"""Initialisiert den Process Guard."""
|
||||
@ -38,6 +39,7 @@ class ProcessGuard:
|
||||
self._is_locked = False
|
||||
self._current_process = None
|
||||
self._current_platform = None
|
||||
self._lock_started_at = None # Timestamp für Auto-Timeout
|
||||
|
||||
# Error Tracking
|
||||
self._failure_count = 0
|
||||
@ -95,6 +97,7 @@ class ProcessGuard:
|
||||
self._is_locked = True
|
||||
self._current_process = process_type
|
||||
self._current_platform = platform
|
||||
self._lock_started_at = datetime.now() # Timestamp für Auto-Timeout
|
||||
logger.info(f"Process locked: {process_type} ({platform})")
|
||||
|
||||
def end(self, success: bool):
|
||||
@ -109,6 +112,7 @@ class ProcessGuard:
|
||||
self._is_locked = False
|
||||
self._current_process = None
|
||||
self._current_platform = None
|
||||
self._lock_started_at = None # Timestamp zurücksetzen
|
||||
|
||||
# Fehler-Tracking
|
||||
if success:
|
||||
@ -133,6 +137,7 @@ class ProcessGuard:
|
||||
self._is_locked = False
|
||||
self._current_process = None
|
||||
self._current_platform = None
|
||||
self._lock_started_at = None # Timestamp zurücksetzen
|
||||
self._load_pause_state()
|
||||
|
||||
if self._is_paused():
|
||||
@ -143,12 +148,31 @@ class ProcessGuard:
|
||||
|
||||
def is_locked(self) -> bool:
|
||||
"""
|
||||
Gibt zurück ob aktuell ein Prozess läuft.
|
||||
Gibt zurück ob aktuell ein Prozess läuft (mit Auto-Timeout-Check).
|
||||
|
||||
Returns:
|
||||
True wenn ein Prozess aktiv ist
|
||||
"""
|
||||
return self._is_locked
|
||||
if not self._is_locked:
|
||||
return False
|
||||
|
||||
# Auto-Timeout-Check: Unlock bei hängenden Prozessen
|
||||
if self._lock_started_at:
|
||||
elapsed_minutes = (datetime.now() - self._lock_started_at).total_seconds() / 60
|
||||
|
||||
if elapsed_minutes > self.LOCK_TIMEOUT_MINUTES:
|
||||
logger.warning(
|
||||
f"⏰ AUTO-TIMEOUT: Lock nach {int(elapsed_minutes)} Minuten freigegeben. "
|
||||
f"Prozess: {self._current_process} ({self._current_platform})"
|
||||
)
|
||||
# Lock automatisch freigeben
|
||||
self._is_locked = False
|
||||
self._current_process = None
|
||||
self._current_platform = None
|
||||
self._lock_started_at = None
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def is_paused(self) -> bool:
|
||||
"""
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren