aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-10-19 12:28:06 -0500
committerJP Dillingham <jp@dillingham.me>2025-10-19 12:28:06 -0500
commit3ad70da8345653dd004cc1ae588ac05753da9005 (patch)
tree2b678ecf78cfc164debf9e6b769ade1c5b88132f
parent4cee6057f395352687fb65b204ebd89804efdfa6 (diff)
downloadslskd-3ad70da8345653dd004cc1ae588ac05753da9005.tar.gz
prime connection before enqueueing locally
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index a84a494d..a46130c9 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -532,6 +532,18 @@ namespace slskd.Transfers.Downloads
throw;
}
+ // prime the cache for this user, to 1) make sure we can connect, and 2) avoid needing to race for it in the loop
+ try
+ {
+ Log.Debug("Priming message connection to {Username}", username);
+ await Client.ConnectToUserAsync(username, invalidateCache: false, cancellationToken);
+ }
+ catch (Exception ex)
+ {
+ Log.Error(ex, "Failed to connect to {Username}: {Message}", username, ex.Message);
+ throw;
+ }
+
List<string> acquiredLocks = [];
try
@@ -647,20 +659,6 @@ namespace slskd.Transfers.Downloads
return (enqueued, failed);
}
- Log.Debug("Attempting to remotely enqueue {Count} files from {Username}", enqueued.Count, username);
-
- // prime the cache for this user, to 1) make sure we can connect, and 2) avoid needing to race for it in the loop
- try
- {
- Log.Debug("Priming message connection to {Username}", username);
- await Client.ConnectToUserAsync(username, invalidateCache: false, cancellationToken);
- }
- catch (Exception ex)
- {
- Log.Error(ex, "Failed to connect to {Username}: {Message}", username, ex.Message);
- throw;
- }
-
/*
the files are all now in the database in the Queued | Locally state.