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