Skip to content

Commit

Permalink
Async & package changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Plenyx committed Aug 16, 2024
1 parent 6bab9de commit dc6e428
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ protected async Task StartUpAndCommandArgs()
var args = Environment.GetCommandLineArgs();
if (args.Length <= 1)
{
await HandleLogReuploads();
HandleLogReuploads();
return;
}
var argIndex = -1;
Expand Down Expand Up @@ -692,7 +692,7 @@ protected async Task StartUpAndCommandArgs()
}
}
}
await HandleLogReuploads();
HandleLogReuploads();
}

protected async Task ValidateGW2Tokens()
Expand Down Expand Up @@ -1696,7 +1696,7 @@ private void TimerCheckUpdate_Elapsed(object sender, EventArgs e)

private void TimerFailedLogsReupload_Elapsed(object sender, EventArgs e)
{
_ = HandleLogReuploads();
HandleLogReuploads();
}

private void EnsureReuploadTimerStart()
Expand All @@ -1708,14 +1708,14 @@ private void EnsureReuploadTimerStart()
timerFailedLogsReupload.Start();
}

private async Task HandleLogReuploads()
private void HandleLogReuploads()
{
if (LogReuploader.FailedLogs.Count == 0)
{
return;
}
AddToText($">:> Starting log reuploads of {LogReuploader.FailedLogs.Count} log{(LogReuploader.FailedLogs.Count > 1 ? "s" : "")}...");
await LogReuploader.ProcessLogs(semaphore, HttpUploadLogAsync);
LogReuploader.ProcessLogs(semaphore, HttpUploadLogAsync);
AddToText(">:> Log reuploading has ended.");
}

Expand Down
4 changes: 2 additions & 2 deletions PlenBotLogUploader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
<PackageReference Include="HttpClientController" Version="1.0.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="111.3.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="111.4.1" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="TextTableFormatter.NET" Version="2.0.1" />
<PackageReference Include="TwitchIrcClient" Version="1.2.2" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.6" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.8" />
</ItemGroup>
<ItemGroup>
<SupportedPlatform Include="windows" />
Expand Down
4 changes: 2 additions & 2 deletions Tools/LogReuploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ internal static bool RemovedLogAndSave(string file)
return removed;
}

internal static async Task ProcessLogs(SemaphoreSlim semaphore, Func<string, Dictionary<string, string>, bool, Task> process)
internal static void ProcessLogs(SemaphoreSlim semaphore, Func<string, Dictionary<string, string>, bool, Task> process)
{
foreach (var fileName in FailedLogs.ToArray())
foreach (var fileName in FailedLogs.ToArray().AsSpan())
{
if (!File.Exists(fileName))
{
Expand Down

0 comments on commit dc6e428

Please sign in to comment.