aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-11-01 16:25:33 -0600
committerJP Dillingham <jp@dillingham.me>2026-11-01 16:25:33 -0600
commit95836a29adfc10ecf65fc41b6ef16368df8846e5 (patch)
tree924e234a9bebcc0aaf8cdbfba73121a57e13a5a0
parent0dadd7b8924167cabb1807693751df7ba6fca588 (diff)
downloadslskd-95836a29adfc10ecf65fc41b6ef16368df8846e5.tar.gz
move change of state pending retry to where it won't skew metrics or history
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index 33bec3ee..5a5fe699 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -1228,18 +1228,6 @@ namespace slskd.Transfers.Downloads
transfer.EnqueuedAt ??= DateTime.UtcNow;
}
- // important! the transfer on the Soulseek.NET side may have completed, but the slskd transfer
- // *might* still have remaining retry attempts. leave this non-committal for now, and allow
- // the final update after all retry attempts have been exhausted to add it.
- // this means that the ONLY way to check whether a transfer is really 'dead' inclusive of all
- // retries is to look for this flag
- if (args.Transfer.State.HasFlag(TransferStates.Completed)
- && !args.Transfer.State.HasFlag(TransferStates.Succeeded)
- && transfer.Attempts < retryOptions.Attempts)
- {
- transfer.State = TransferStates.Queued | TransferStates.Locally;
- }
-
Telemetry.Metrics.Update(() =>
{
if (!TransferStateCategories.Queued.Contains(args.PreviousState) && TransferStateCategories.Queued.Contains(transfer.State))
@@ -1259,6 +1247,18 @@ namespace slskd.Transfers.Downloads
stateHistory.Add(transfer.State);
+ // important! the transfer on the Soulseek.NET side may have completed, but the slskd transfer
+ // *might* still have remaining retry attempts. leave this non-committal for now, and allow
+ // the final update after all retry attempts have been exhausted to add it.
+ // this means that the ONLY way to check whether a transfer is really 'dead' inclusive of all
+ // retries is to look for this flag
+ if (args.Transfer.State.HasFlag(TransferStates.Completed)
+ && !args.Transfer.State.HasFlag(TransferStates.Succeeded)
+ && transfer.Attempts < retryOptions.Attempts)
+ {
+ transfer.State = TransferStates.Queued | TransferStates.Locally;
+ }
+
// todo: broadcast
SynchronizedUpdate(transfer, semaphore: updateSyncRoot, cancellationToken: cancellationToken);
}