Commit graph

17 commits

Author SHA1 Message Date
SergeantPanda
38c89402f8 Enhancement: Update psycopg2 to 3. 2026-05-28 19:46:58 -05:00
SergeantPanda
c33d456743 Enable gevent in uWSGI workers; fix WS delivery and DB exhaustion
- Enable gevent cooperative multitasking in all uWSGI worker configs
  (gevent-early-monkey-patch + import dispatcharr.gevent_patch)
- Rewrite WebSocket group sends to bypass asyncio in gevent workers:
  _gevent_ws_send() replicates the channels_redis 4.x wire format
  directly via synchronous Redis so send_websocket_update() and
  _send_async() no longer fail silently after epoll is patched out
- Fix PostgreSQL connection exhaustion: CONN_MAX_AGE=0 + explicit
  close_old_connections() in stream manager and cleanup watchdog loops
- Fix stream proxy race: register client before the connect-wait loop
  so the cleanup watchdog never sees zero clients on a live channel
- Channel list/logo/profile queryset optimisations: conditional DISTINCT,
  EXISTS semi-joins for filter-options, channel_count annotation to
  eliminate N+1 in LogoSerializer, prefetched memberships in
  ChannelProfileSerializer
- JsonResponse for channel ID list and summary endpoints
2026-05-14 18:55:09 -05:00
SergeantPanda
c956672587 Enhancement: Route long-running DVR recordings to a dedicated queue. 2026-04-26 09:34:20 -05:00
Jeff Casimir
4796184a67 Fix uWSGI segfaults by disabling threads when using gevent
Mixing threading and gevent concurrency models causes uWSGI workers to
crash with segmentation faults, particularly on ARM64/Python 3.13.

The production uwsgi.ini was already correct (gevent without threads).
This fixes the dev and debug configs to match.

References:
- https://github.com/gevent/gevent/issues/1784
- https://github.com/unbit/uwsgi/issues/2457

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:02:39 -07:00
SergeantPanda
62f5c32609 Remove DJANGO_SECRET_KEY environment variable from uwsgi configuration files 2025-12-08 17:27:07 -06:00
SergeantPanda
3512c3a623 Add DJANGO_SECRET_KEY environment variable to uwsgi configuration files 2025-12-07 19:05:31 -06:00
SergeantPanda
119b222428 Enhancement: Allow setting both Celery and UWSGI nice levels. Default nice levels are UWSGI=0, Celery=5. Added documentation to the compose files on how to use it. Using nice levels for UWSGI allows us to have streaming run at a high priority. 2025-10-21 10:11:53 -05:00
SergeantPanda
134093b18e Enhancement: Add 'nice -n 5' to celery commands in configuration files for better process priority management 2025-09-27 15:32:29 -05:00
SergeantPanda
6ce387b0b0 Auto-scales Celery based on demand. Should lower overall memory and CPU usage while allowing for high cpu demand tasks to complete quickly.
Closes #111
2025-06-02 18:03:32 -05:00
SergeantPanda
303123f3ec Buffer overflow error. 2025-05-21 09:44:09 -05:00
SergeantPanda
1174e2e0c7 EPG processing enhancements. Celery memory management. 2025-05-17 16:42:37 -05:00
SergeantPanda
44a79d2a8a Log UWSGI if debug is set (DISPATCHARR_DEBUG=true) 2025-05-14 18:49:46 -05:00
SergeantPanda
24fba3c2b1 Change some celery tasks from info to debug. 2025-05-10 09:58:57 -05:00
SergeantPanda
d3615e1a66 Huge overhaul of logging. More standardized and we are now capturing logs from celery task and sening to console.
Also adds a new environmental variable: DISPATCHARR_LOG_LEVEL, log levels available: TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL
2025-05-10 09:29:06 -05:00
SergeantPanda
58773c015c Modify logging levels of uwsgi and fix epg tasks not being deleted when epg is deleted. 2025-05-08 19:47:05 -05:00
SergeantPanda
c99e6b68bc Increase the number of threads from 4 to 8 in uwsgi configuration for improved concurrency 2025-03-28 09:39:57 -05:00
SergeantPanda
1fcedab1ab Remote debugging initial commit. 2025-03-27 09:49:51 -05:00