mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
[PR #11092] [MERGED] refactor: use Channels as queueing mechanism for periodic websocket messages #12555
Labels
No labels
area:database
awaiting-feedback
backend
blocked
breaking change: web api
bug
build
ci
confirmed
discussion needed
dotnet future
downstream
duplicate
EFjellyfin.db
enhancement
feature
future
github-actions
good first issue
hdr
help wanted
invalid
investigation
librarydb
live-tv
lyrics
media playback
music
needs testing
nuget
performance
platform
pull-request
question
regression
release critical
requires-web
roadmap
security
security
stale
support
syncplay
ui & ux
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/jellyfin#12555
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/11092
Author: @cvium
Created: 3/2/2024
Status: ✅ Merged
Merged: 3/18/2024
Merged by: @crobibero
Base:
master← Head:reduce_threads_in_baseperiodicwebsocketlistener📝 Commits (6)
14b5b31refactor: use Channels as queueing mechanism for periodic websocket messagesa6766d8change all lock statements to semaphoreslimccf16b8Apply suggestions from code review3641d8cadd more short circuits6809574refactor to IAsyncDisposable and complete the Writer channel9ea09fdlog channel errors during dispose📊 Changes
5 files changed (+169 additions, -107 deletions)
View changed files
📝
Emby.Server.Implementations/Session/SessionManager.cs(+2 -5)📝
Jellyfin.Api/WebSocketListeners/ActivityLogWebSocketListener.cs(+8 -5)📝
Jellyfin.Api/WebSocketListeners/ScheduledTasksWebSocketListener.cs(+12 -9)📝
Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs(+19 -17)📝
MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs(+128 -71)📄 Description
The old implementation used async void as the signature for the event handlers, which might lead to thread pool exhaustion as handlers would fetch the data synchronously despite the async signature on GetDataToSend. Furthermore, on every event, the list of active connections were retrieved inside a
lockstatement, which could also lead to threads being blocked during high traffic scenarios.Queueing a bool is not great design, but this change only aims to alleviate the thread pool exhaustion.
Issues
Might fix #7783, but I have not been able to reproduce it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.