[CHANGE] BackgroundServices

This commit is contained in:
max
2025-09-09 19:11:02 +02:00
parent d183803390
commit 2593d02a73
7 changed files with 188 additions and 17 deletions

View File

@@ -0,0 +1,23 @@
using Manager.App.Models.System;
namespace Manager.App.Services.System;
public class BackgroundServiceManager
{
private readonly HashSet<ExtendedBackgroundService> _backgroundServices = [];
public void RegisterService(ExtendedBackgroundService service)
{
_backgroundServices.Add(service);
}
public ListResult<ExtendedBackgroundService> GetServices(string serviceName, int total = 20, int skip = 0)
{
var filtered = string.IsNullOrWhiteSpace(serviceName) ? _backgroundServices.ToArray() : _backgroundServices.Where(x => x.Name.Equals(serviceName, StringComparison.OrdinalIgnoreCase)).ToArray();
var results = filtered.OrderDescending()
.Skip(skip)
.Take(total);
return new ListResultReturn<ExtendedBackgroundService>(results.ToList(), filtered.Length);
}
}