This commit is contained in:
SergeantPanda 2025-03-04 13:25:45 -06:00
commit f1f8b3d6ce
4 changed files with 18 additions and 12 deletions

View file

@ -79,6 +79,7 @@ def stream_view(request, stream_id):
logger.debug('Profile is not active, skipping.')
continue
logger.debug(f'Profile has a max streams of {profile.max_streams}')
# Acquire the persistent Redis lock, indexed by 0 through max_streams available in the profile
stream_index = 0
while True:
@ -89,9 +90,10 @@ def stream_view(request, stream_id):
logger.debug(f"Profile is using all available streams.")
break
lock_key = f"lock:{channel.id}:{stream.id}:{profile.id}:{stream_index}"
lock_key = f"lock:{profile.id}:{stream_index}"
persistent_lock = PersistentLock(redis_client, lock_key, lock_timeout=120)
logger.debug(f'Attempting to acquire lock: {lock_key}')
if not persistent_lock.acquire():
logger.error(f"Could not acquire persistent lock for profile {profile.id} index {stream_index}, currently in use.")
continue

View file

@ -3,7 +3,7 @@ services:
# build:
# context: ..
# dockerfile: docker/Dockerfile.dev
image: dispatcharr/dispatcharr:dev
image: dispatcharr/dispatcharr
container_name: dispatcharr_dev
ports:
- "5656:5656"
@ -12,6 +12,5 @@ services:
- ../:/app
environment:
- DISPATCHARR_ENV=dev
- DB_ENGINE=sqlite
- REDIS_HOST=localhost
- CELERY_BROKER_URL=redis://localhost:6379/0

View file

@ -85,7 +85,12 @@ if [ "$DISPATCHARR_ENV" = "dev" ]; then
echo "🚀 Development Mode - Setting up Frontend..."
# Install Node.js
apt-get update && apt-get install -y nodejs
echo "=== setting up nodejs ==="
curl -sL https://deb.nodesource.com/setup_23.x -o /tmp/nodesource_setup.sh
bash /tmp/nodesource_setup.sh
apt-get update
apt-get install -y --no-install-recommends \
nodejs
# Install frontend dependencies
cd /app/frontend && npm install
@ -94,12 +99,18 @@ if [ "$DISPATCHARR_ENV" = "dev" ]; then
# Start React development server
echo "🚀 Starting React Dev Server..."
cd /app/frontend
su - $POSTGRES_USER -c "PORT=9191 /app/frontend/node_modules/pm2/bin/pm2 --name dev-server start npm -- start"
su - $POSTGRES_USER -c "cd /app/frontend && /app/frontend/node_modules/pm2/bin/pm2 --name dev-server start npm -- run start"
./node_modules/pm2/bin/pm2 logs &
react_pid=$(cat /home/dispatch/.pm2/pids/dev-server*)
echo "✅ React started with PID $react_pid"
pids+=("$react_pid")
cd /app
else
echo "🚀 Starting nginx..."
nginx
nginx_pid=$(pgrep nginx | sort | head -n1)
echo "✅ nginx started with PID $nginx_pid"
pids+=("$nginx_pid")
fi
# If running in `dev` or `aio`, start Postgres, Redis, and Celery
@ -207,12 +218,6 @@ gunicorn_pid=$(pgrep -x gunicorn | sort | head -n1)
echo "✅ Gunicorn started with PID $gunicorn_pid"
pids+=("$gunicorn_pid")
echo "🚀 Starting nginx..."
nginx
nginx_pid=$(pgrep nginx | sort | head -n1)
echo "✅ nginx started with PID $nginx_pid"
pids+=("$nginx_pid")
# Log PIDs
echo "📝 Process PIDs: ${pids[*]}"

View file

@ -104,7 +104,7 @@ const ChannelsTable = () => {
};
function handleWatchStream(channelNumber) {
showVideo(`http://192.168.1.151:5656/output/stream/${channelNumber}/`);
showVideo(`/output/stream/${channelNumber}/`);
}
// (Optional) bulk delete, but your endpoint is @TODO