aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-01-11 22:38:00 -0600
committerJP Dillingham <jp@dillingham.me>2024-01-11 22:38:00 -0600
commit37693e0e4fabef5395bb7644ce0c014e1efc3084 (patch)
tree8fdfbc8aa5a5a588fa72492f70f16d31a25eacca
parent1efd59f43312b33e8db62d4e0fed339bda462dde (diff)
downloadslskd-37693e0e4fabef5395bb7644ce0c014e1efc3084.tar.gz
wip
-rw-r--r--src/slskd/Application.cs86
-rw-r--r--src/slskd/Transfers/Uploads/UploadService.cs3
2 files changed, 46 insertions, 43 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 67c6dc85..4c794179 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -587,49 +587,49 @@ namespace slskd
throw new DownloadEnqueueException($"Queued {queuedReason}");
}
- // start with weekly, as this is the most likely limit to be hit and we want to keep the work to a minimum
- var erroredState = TransferStates.Completed | TransferStates.Errored;
- var cutoffDateTime = DateTime.UtcNow.AddDays(-7);
- var weekly = Transfers.Uploads.Hypothesize(
- expression: t =>
- t.Username == username
- && t.StartedAt >= cutoffDateTime
- && !t.State.HasFlag(erroredState)
- && t.Exception == null,
- hypothetical: new Transfers.Transfer()
- {
- Filename = resolved.Filename,
- Size = resolved.Size,
- });
-
- Log.Debug("Fetched weekly stats: {Stats} ({Time}ms)", weekly, sw.ElapsedMilliseconds);
-
- if (OverLimits(weekly, limits.Weekly, out var weeklyReason))
- {
- Log.Information("Rejected enqueue request for user {Username}: Weekly {Reason}", weeklyReason);
- throw new DownloadEnqueueException($"Weekly {weeklyReason}");
- }
-
- cutoffDateTime = DateTime.UtcNow.AddDays(-1);
- var daily = Transfers.Uploads.Hypothesize(
- expression: t =>
- t.Username == username
- && t.StartedAt >= cutoffDateTime
- && !t.State.HasFlag(erroredState)
- && t.Exception == null,
- hypothetical: new Transfers.Transfer()
- {
- Filename = resolved.Filename,
- Size = resolved.Size,
- });
-
- Log.Debug("Fetched daily stats: {Stats} ({Time}ms)", weekly, sw.ElapsedMilliseconds);
-
- if (OverLimits(daily, limits.Daily, out var dailyReason))
- {
- Log.Information("Rejected enqueue request for user {Username}: Daily {Reason}", dailyReason);
- throw new DownloadEnqueueException($"Daily {dailyReason}");
- }
+ //// start with weekly, as this is the most likely limit to be hit and we want to keep the work to a minimum
+ //var erroredState = TransferStates.Completed | TransferStates.Errored;
+ //var cutoffDateTime = DateTime.UtcNow.AddDays(-7);
+ //var weekly = Transfers.Uploads.Hypothesize(
+ // expression: t =>
+ // t.Username == username
+ // && t.StartedAt >= cutoffDateTime
+ // && !t.State.HasFlag(erroredState)
+ // && t.Exception == null,
+ // hypothetical: new Transfers.Transfer()
+ // {
+ // Filename = resolved.Filename,
+ // Size = resolved.Size,
+ // });
+
+ //Log.Debug("Fetched weekly stats: {Stats} ({Time}ms)", weekly, sw.ElapsedMilliseconds);
+
+ //if (OverLimits(weekly, limits.Weekly, out var weeklyReason))
+ //{
+ // Log.Information("Rejected enqueue request for user {Username}: Weekly {Reason}", weeklyReason);
+ // throw new DownloadEnqueueException($"Weekly {weeklyReason}");
+ //}
+
+ //cutoffDateTime = DateTime.UtcNow.AddDays(-1);
+ //var daily = Transfers.Uploads.Hypothesize(
+ // expression: t =>
+ // t.Username == username
+ // && t.StartedAt >= cutoffDateTime
+ // && !t.State.HasFlag(erroredState)
+ // && t.Exception == null,
+ // hypothetical: new Transfers.Transfer()
+ // {
+ // Filename = resolved.Filename,
+ // Size = resolved.Size,
+ // });
+
+ //Log.Debug("Fetched daily stats: {Stats} ({Time}ms)", weekly, sw.ElapsedMilliseconds);
+
+ //if (OverLimits(daily, limits.Daily, out var dailyReason))
+ //{
+ // Log.Information("Rejected enqueue request for user {Username}: Daily {Reason}", dailyReason);
+ // throw new DownloadEnqueueException($"Daily {dailyReason}");
+ //}
sw.Stop();
Log.Debug("Enqueue decision made in {Duration}ms", sw.ElapsedMilliseconds);
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs
index 6a735696..6f01219e 100644
--- a/src/slskd/Transfers/Uploads/UploadService.cs
+++ b/src/slskd/Transfers/Uploads/UploadService.cs
@@ -480,6 +480,9 @@ namespace slskd.Transfers.Uploads
directories.Add(t.Filename.NormalizePathForSoulseek().GetNormalizedDirectoryName());
}
+ Log.Warning("Directories: {@Directories}", directories);
+ Log.Warning("Files: {@Files}", files);
+
return (transfers, files.Count, directories.Count, bytes);
}