Removed semaphore
This commit is contained in:
parent
dca4bf39a0
commit
721ad63add
@ -60,8 +60,6 @@ namespace NadekoBot
|
|||||||
public INServiceProvider Services { get; private set; }
|
public INServiceProvider Services { get; private set; }
|
||||||
public BotCredentials Credentials { get; }
|
public BotCredentials Credentials { get; }
|
||||||
|
|
||||||
private const string _mutexName = @"Global\nadeko_shards_lock";
|
|
||||||
private readonly Semaphore sem = new Semaphore(1, 1, _mutexName);
|
|
||||||
public int ShardId { get; }
|
public int ShardId { get; }
|
||||||
public ShardsCoordinator ShardCoord { get; private set; }
|
public ShardsCoordinator ShardCoord { get; private set; }
|
||||||
|
|
||||||
@ -313,23 +311,13 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
//connect
|
//connect
|
||||||
try { sem.WaitOne(); } catch (AbandonedMutexException) { }
|
|
||||||
|
|
||||||
_log.Info("Shard {0} logging in ...", ShardId);
|
_log.Info("Shard {0} logging in ...", ShardId);
|
||||||
|
await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false);
|
||||||
try
|
await Client.StartAsync().ConfigureAwait(false);
|
||||||
{
|
Client.Ready += SetClientReady;
|
||||||
await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false);
|
await clientReady.Task.ConfigureAwait(false);
|
||||||
await Client.StartAsync().ConfigureAwait(false);
|
Client.Ready -= SetClientReady;
|
||||||
Client.Ready += SetClientReady;
|
_log.Info("Shard {0} logged in.", ShardId);
|
||||||
await clientReady.Task.ConfigureAwait(false);
|
|
||||||
Client.Ready -= SetClientReady;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_log.Info("Shard {0} logged in.", ShardId);
|
|
||||||
sem.Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RunAsync(params string[] args)
|
public async Task RunAsync(params string[] args)
|
||||||
|
Loading…
Reference in New Issue
Block a user