Bot Discord - Commit completo con todos los cambios

This commit is contained in:
Admin
2026-01-16 20:24:38 -06:00
commit cf8ecfcf64
151 changed files with 28808 additions and 0 deletions

43
scripts/start_worker_pool.php Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
// scripts/start_worker_pool.php
// Script para iniciar el pool de workers de traducción
// Permitir ejecución indefinida
set_time_limit(0);
// Verificar que se ejecuta desde CLI
if (php_sapi_name() !== 'cli') {
die("Este script solo puede ejecutarse desde la línea de comandos.\n");
}
// Cargar configuración
require_once __DIR__ . '/../config/config.php';
require_once __DIR__ . '/../includes/db.php';
require_once __DIR__ . '/../includes/logger.php';
require_once __DIR__ . '/../src/TranslationWorkerPool.php';
custom_log("=== INICIANDO POOL DE WORKERS DE TRADUCCIÓN ===");
custom_log("Environment: " . (getenv('APP_ENVIRONMENT') ?: 'default'));
custom_log("PID del proceso principal: " . getmypid());
try {
// Verificar que PCNTL está disponible
if (!function_exists('pcntl_fork')) {
throw new Exception("La extensión PCNTL no está disponible. Instala php-pcntl.");
}
// Crear pool de workers
$pool = new TranslationWorkerPool($pdo);
// Iniciar pool (esto bloqueará hasta que se detenga)
$pool->start();
} catch (Exception $e) {
custom_log("ERROR FATAL: " . $e->getMessage());
custom_log("Stack trace: " . $e->getTraceAsString());
exit(1);
}
custom_log("=== POOL DE WORKERS DETENIDO ===");
exit(0);