update top level client count stats to support filtering per game
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Data.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
@ -21,13 +22,13 @@ public class Info : BaseController
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(int period = 24, CancellationToken token = default)
|
||||
public async Task<IActionResult> Get(int period = 24, Reference.Game? game = null, CancellationToken token = default)
|
||||
{
|
||||
// todo: this is hardcoded currently because the cache doesn't take into consideration the duration, so
|
||||
// we could impact the webfront usage too
|
||||
var duration = TimeSpan.FromHours(24);
|
||||
var (totalClients, totalRecentClients) =
|
||||
await _serverDataViewer.ClientCountsAsync(duration, token);
|
||||
await _serverDataViewer.ClientCountsAsync(duration, game, token);
|
||||
var (maxConcurrent, maxConcurrentTime) = await _serverDataViewer.MaxConcurrentClientsAsync(overPeriod: duration, token: token);
|
||||
var response = new InfoResponse
|
||||
{
|
||||
|
Reference in New Issue
Block a user