diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-05 09:11:44 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-10-05 09:11:44 -0500 |
| commit | b38d9f01862b4fc27874bf99d4b24b53a6577bd0 (patch) | |
| tree | 1610fcf6b7d453580492af2c4f64759b77def724 /src | |
| parent | 67999bda3007baf735b5a14926c1b6e4c22e4a55 (diff) | |
| download | slskd-b38d9f01862b4fc27874bf99d4b24b53a6577bd0.tar.gz | |
make forecast zero-based to match estimation (and to make it more suitable for gauging queue depth)
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadQueue.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadQueue.cs b/src/slskd/Transfers/Uploads/UploadQueue.cs index ccd1f5f2..cb071d25 100644 --- a/src/slskd/Transfers/Uploads/UploadQueue.cs +++ b/src/slskd/Transfers/Uploads/UploadQueue.cs @@ -97,7 +97,7 @@ namespace slskd.Transfers.Uploads /// <summary> /// Computes the estimated queue position of the specified <paramref name="username"/> if they were to enqueue a file, - /// or zero if the transfer could start immediately. + /// along with the slot counts for the user's group. /// </summary> /// <remarks> /// The returned position is relative to the user's group only. Higher priority groups are not factored in @@ -106,7 +106,7 @@ namespace slskd.Transfers.Uploads /// </remarks> /// <param name="username">The username for which to estimate.</param> /// <returns> - /// The estimated queue position if the user were to enqueue a file, or zero if the transfer could start immediately. + /// The user's group, the group's total and free slots, and the estimated position if the user were to enqueue a file. /// </returns> (string Group, int TotalSlots, int FreeSlots, int Position) ForecastPosition(string username); } @@ -394,7 +394,7 @@ namespace slskd.Transfers.Uploads /// <summary> /// Computes the estimated queue position of the specified <paramref name="username"/> if they were to enqueue a file, - /// or zero if the transfer could start immediately. + /// along with the slot counts for the user's group. /// </summary> /// <remarks> /// The returned position is relative to the user's group only. Higher priority groups are not factored in @@ -403,7 +403,7 @@ namespace slskd.Transfers.Uploads /// </remarks> /// <param name="username">The username for which to estimate.</param> /// <returns> - /// The estimated queue position if the user were to enqueue a file, or zero if the transfer could start immediately. + /// The user's group, the group's total and free slots, and the estimated position if the user were to enqueue a file. /// </returns> public (string Group, int TotalSlots, int FreeSlots, int Position) ForecastPosition(string username) { @@ -428,15 +428,15 @@ namespace slskd.Transfers.Uploads var uploadsForGroup = UploadDictionary.Where(kvp => Users.GetGroup(kvp.Key) == groupName); // assuming that the queue will be processed in a true round-robin fashion and that the user will be the last in the - // rotation (worst case), the user's start position will be equal to the number of users downloading or waiting, + 1. + // rotation (worst case), the user's start position will be equal to the number of users downloading or waiting. if (groupRecord.Strategy == QueueStrategy.RoundRobin) { - return (groupName, totalSlots, freeSlots, uploadsForGroup.Count() + 1); + return (groupName, totalSlots, freeSlots, uploadsForGroup.Count()); } // for FIFO queues, the user will enter the queue at the very back. return the total number of uploads in progress and - // enqueued, + 1. - return (groupName, totalSlots, freeSlots, uploadsForGroup.Sum(kvp => kvp.Value.Count) + 1); + // enqueued. + return (groupName, totalSlots, freeSlots, uploadsForGroup.Sum(kvp => kvp.Value.Count)); } private void Configure(Options options) |
