Small change to Bot.cs to pinpoint the logging in hang issue

This commit is contained in:
Kwoth
2022-03-03 01:13:49 +01:00
parent 63ced029ab
commit 323699d103

View File

@@ -216,11 +216,9 @@ public sealed class Bot
private async Task LoginAsync(string token) private async Task LoginAsync(string token)
{ {
var clientReady = new TaskCompletionSource<bool>(); var clientReady = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
Task SetClientReady() async Task SetClientReady()
{
_ = Task.Run(async () =>
{ {
clientReady.TrySetResult(true); clientReady.TrySetResult(true);
try try
@@ -232,8 +230,6 @@ public sealed class Bot
{ {
// ignored // ignored
} }
});
return Task.CompletedTask;
} }
//connect //connect
@@ -241,6 +237,7 @@ public sealed class Bot
try try
{ {
await Client.LoginAsync(TokenType.Bot, token); await Client.LoginAsync(TokenType.Bot, token);
Log.Information("Starting...");
await Client.StartAsync(); await Client.StartAsync();
} }
catch (HttpException ex) catch (HttpException ex)