From c05049e54edfc3e22c87ea7f3bfd1efd997600b1 Mon Sep 17 00:00:00 2001 From: gnattu Date: Sat, 29 Jun 2024 14:11:28 +0800 Subject: [PATCH] Filter full device list only once Signed-off-by: gnattu --- Jellyfin.Server.Implementations/Devices/DeviceManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs index b74cc90fe0..25f5f4f6af 100644 --- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs +++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs @@ -137,10 +137,11 @@ namespace Jellyfin.Server.Implementations.Devices /// public QueryResult GetDevices(DeviceQuery query) { - var devices = _devices.Values.OrderBy(d => d.Id) + IEnumerable devices = _devices.Values.OrderBy(d => d.Id) .Where(device => !query.UserId.HasValue || device.UserId.Equals(query.UserId.Value)) .Where(device => query.DeviceId == null || device.DeviceId == query.DeviceId) - .Where(device => query.AccessToken == null || device.AccessToken == query.AccessToken); + .Where(device => query.AccessToken == null || device.AccessToken == query.AccessToken) + .ToList(); var count = devices.Count(); if (query.Skip.HasValue)