#!/usr/bin/env bash
# Starts the web app, both queue workers and the scheduler (macOS/Linux, local use). Ctrl+C stops all.
cd "$(dirname "$0")"
FAST=$(grep -E '^SEO_FAST_QUEUE_CONNECTION=' .env | cut -d= -f2); FAST=${FAST:-redis}
LONG=$(grep -E '^SEO_LONG_QUEUE_CONNECTION=' .env | cut -d= -f2); LONG=${LONG:-redis-long}
trap 'kill 0' EXIT
php artisan serve &
php artisan queue:work "$FAST" --queue=uptime,default --tries=3 --timeout=60 &
php artisan queue:work "$LONG" --queue=crawl,audit,reports,integrations --timeout=1200 --memory=512 &
php artisan schedule:work &
echo "Open http://127.0.0.1:8000"
wait
