Removed semaphore

This commit is contained in:
Master Kwoth 2017-06-25 08:00:52 +02:00
parent dca4bf39a0
commit 721ad63add

View File

@ -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);
try
{
await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false); await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false);
await Client.StartAsync().ConfigureAwait(false); await Client.StartAsync().ConfigureAwait(false);
Client.Ready += SetClientReady; Client.Ready += SetClientReady;
await clientReady.Task.ConfigureAwait(false); await clientReady.Task.ConfigureAwait(false);
Client.Ready -= SetClientReady; Client.Ready -= SetClientReady;
}
finally
{
_log.Info("Shard {0} logged in.", ShardId); _log.Info("Shard {0} logged in.", ShardId);
sem.Release();
}
} }
public async Task RunAsync(params string[] args) public async Task RunAsync(params string[] args)