diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-28 09:09:14 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-06-28 09:09:14 -0500 |
| commit | 34265b07a022293a122e313959732805963d41f2 (patch) | |
| tree | c4730045bd04faa5b5ba7b47d9cbcf50ae41034a /src | |
| parent | 08952e1269c9c7e1e5cfae494d3e546219b66f0c (diff) | |
| download | slskd-34265b07a022293a122e313959732805963d41f2.tar.gz | |
use single call to forecast
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index a12e039b..4e6444a3 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -869,17 +869,16 @@ namespace slskd { await RefreshUserStatisticsIfNeeded(); - var hasFreeSlot = Transfers.Uploads.Queue.IsSlotAvailable(username); - var estimatedQueueLength = Transfers.Uploads.Queue.EstimatePosition(username); + var forecastedPosition = Transfers.Uploads.Queue.ForecastPosition(username); - Console.WriteLine($"[SENDING SEARCH RESULTS]: {results.Count()} records to {username} for query {query.SearchText} (free slot?: {hasFreeSlot}, queue length: {estimatedQueueLength})"); + Console.WriteLine($"[SENDING SEARCH RESULTS]: {results.Count()} records to {username} for query {query.SearchText} (forecasted position: {forecastedPosition})"); return new SearchResponse( Client.Username, token, uploadSpeed: State.CurrentValue.Server.Statistics.AverageSpeed, - freeUploadSlots: hasFreeSlot ? 1 : 0, - queueLength: estimatedQueueLength, + freeUploadSlots: forecastedPosition == 0 ? 1 : 0, + queueLength: forecastedPosition, fileList: results); } |
