This commit is contained in:
Lizandro Guarnizo
2026-02-21 10:14:14 -05:00
parent f05d4a20cb
commit 6bab34bf13
2 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -5,6 +5,10 @@
* - Si se solicita JSON (Accept: application/json) la endpoint requiere autenticación y devuelve {success:true,url:...} * - Si se solicita JSON (Accept: application/json) la endpoint requiere autenticación y devuelve {success:true,url:...}
* - Si se accede mediante GET desde navegador, redirige (302) al URL del media (no requiere sesión) * - Si se accede mediante GET desde navegador, redirige (302) al URL del media (no requiere sesión)
*/ */
// Continuar procesando aunque Cloudflare/cliente corte la conexión (evita 502 por timeout)
ignore_user_abort(true);
set_time_limit(300);
require_once __DIR__ . '/../../config/config.php'; require_once __DIR__ . '/../../config/config.php';
// Debugging helpers: log errors to a file and initialize control vars // Debugging helpers: log errors to a file and initialize control vars
@@ -291,7 +295,6 @@ if ($mediaId) {
// ── Si no hay archivo local, descargar con MediaService y guardar como cache permanente ── // ── Si no hay archivo local, descargar con MediaService y guardar como cache permanente ──
if ($mediaId) { if ($mediaId) {
try { try {
set_time_limit(180); // Dar tiempo suficiente para fotos grandes (hasta 5MB)
require_once __DIR__ . '/../../classes/MediaService.php'; require_once __DIR__ . '/../../classes/MediaService.php';
$ms = new MediaService(); $ms = new MediaService();
$subdir = date('Y/m'); $subdir = date('Y/m');
+2 -3
View File
@@ -115,9 +115,9 @@ if [ -f /usr/local/bin/php ]; then
php -r "if(function_exists('opcache_reset')) opcache_reset();" php -r "if(function_exists('opcache_reset')) opcache_reset();"
fi fi
# Configurar crontab para tareas programadas # Configurar crontab para tareas programadas (usar /etc/crontabs/root para que crond lo ejecute como root)
echo "⏰ Configurando cron jobs..." echo "⏰ Configurando cron jobs..."
cat > /etc/crontabs/www <<EOF cat > /etc/crontabs/root <<EOF
# Procesar mensajes delayed cada minuto # Procesar mensajes delayed cada minuto
* * * * * cd /var/www/html && /usr/local/bin/php -r "require 'vendor/autoload.php'; use WhatsApp\Queue\RedisQueue; \$q = new RedisQueue(); \$q->processDelayed('messages'); \$q->processDelayed('media');" 2>&1 | logger -t delayed-processor * * * * * cd /var/www/html && /usr/local/bin/php -r "require 'vendor/autoload.php'; use WhatsApp\Queue\RedisQueue; \$q = new RedisQueue(); \$q->processDelayed('messages'); \$q->processDelayed('media');" 2>&1 | logger -t delayed-processor
@@ -130,7 +130,6 @@ cat > /etc/crontabs/www <<EOF
# Health check de workers (cada 5 minutos) # Health check de workers (cada 5 minutos)
*/5 * * * * supervisorctl status whatsapp-worker:* | grep -q RUNNING || supervisorctl restart whatsapp-worker:* 2>&1 | logger -t worker-monitor */5 * * * * supervisorctl status whatsapp-worker:* | grep -q RUNNING || supervisorctl restart whatsapp-worker:* 2>&1 | logger -t worker-monitor
EOF EOF
chown www:www /etc/crontabs/www
echo "✅ Configuración completada" echo "✅ Configuración completada"
echo "🎯 Iniciando servicios..." echo "🎯 Iniciando servicios..."