make sure to resend the data

This commit is contained in:
rootdarkarchon
2024-01-20 00:05:55 +01:00
parent a1193875a5
commit b9ef6503d2
3 changed files with 13 additions and 2 deletions

View File

@@ -126,8 +126,17 @@ public class FileTransferOrchestrator : DisposableMediatorSubscriberBase
MareConfiguration.Models.DownloadSpeeds.MBps => limit * 1024 * 1024, MareConfiguration.Models.DownloadSpeeds.MBps => limit * 1024 * 1024,
_ => limit, _ => limit,
}; };
var dividedLimit = limit / (CurrentlyUsedDownloadSlots == 0 ? 1 : CurrentlyUsedDownloadSlots); var currentUsedDlSlots = CurrentlyUsedDownloadSlots;
return dividedLimit == 0 ? 1 : dividedLimit; var avaialble = _availableDownloadSlots;
var currentCount = _downloadSemaphore.CurrentCount;
var dividedLimit = limit / (currentUsedDlSlots == 0 ? 1 : currentUsedDlSlots);
if (dividedLimit < 0)
{
Logger.LogWarning("Calculated Bandwidth Limit is negative, returning Infinity: {value}, CurrentlyUsedDownloadSlots is {currentSlots}, " +
"DownloadSpeedLimit is {limit}, available slots: {avail}, current count: {count}", dividedLimit, currentUsedDlSlots, limit, avaialble, currentCount);
return long.MaxValue;
}
return Math.Clamp(dividedLimit, 1, long.MaxValue);
} }
private async Task<HttpResponseMessage> SendRequestInternalAsync(HttpRequestMessage requestMessage, private async Task<HttpResponseMessage> SendRequestInternalAsync(HttpRequestMessage requestMessage,

View File

@@ -16,6 +16,7 @@ public partial class ApiController
try try
{ {
Logger.LogDebug("Pushing Character data {hash} to {visible}", data.DataHash, string.Join(", ", visibleCharacters.Select(v => v.AliasOrUID)));
await PushCharacterDataInternal(data, [.. visibleCharacters]).ConfigureAwait(false); await PushCharacterDataInternal(data, [.. visibleCharacters]).ConfigureAwait(false);
} }
catch (OperationCanceledException) catch (OperationCanceledException)

View File

@@ -406,6 +406,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
} }
await LoadIninitialPairs().ConfigureAwait(false); await LoadIninitialPairs().ConfigureAwait(false);
await LoadOnlinePairs().ConfigureAwait(false); await LoadOnlinePairs().ConfigureAwait(false);
Mediator.Publish(new ConnectedMessage(_connectionDto));
} }
catch (Exception ex) catch (Exception ex)
{ {