up
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
* - 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)
|
||||
*/
|
||||
// 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';
|
||||
|
||||
// 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 ──
|
||||
if ($mediaId) {
|
||||
try {
|
||||
set_time_limit(180); // Dar tiempo suficiente para fotos grandes (hasta 5MB)
|
||||
require_once __DIR__ . '/../../classes/MediaService.php';
|
||||
$ms = new MediaService();
|
||||
$subdir = date('Y/m');
|
||||
|
||||
@@ -115,9 +115,9 @@ if [ -f /usr/local/bin/php ]; then
|
||||
php -r "if(function_exists('opcache_reset')) opcache_reset();"
|
||||
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..."
|
||||
cat > /etc/crontabs/www <<EOF
|
||||
cat > /etc/crontabs/root <<EOF
|
||||
# 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
|
||||
|
||||
@@ -130,7 +130,6 @@ cat > /etc/crontabs/www <<EOF
|
||||
# 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
|
||||
EOF
|
||||
chown www:www /etc/crontabs/www
|
||||
|
||||
echo "✅ Configuración completada"
|
||||
echo "🎯 Iniciando servicios..."
|
||||
|
||||
Reference in New Issue
Block a user