Fixed some NRT warnings in pub/sub mechanism

This commit is contained in:
Kwoth
2021-12-29 06:59:41 +01:00
parent 82000c97a4
commit 6eee161b6b
5 changed files with 44 additions and 34 deletions

View File

@@ -2,25 +2,25 @@ var pid = Environment.ProcessId;
var shardId = 0;
int? totalShards = null; // 0 to read from creds.yml
// if (args.Length > 0)
// {
// if (!int.TryParse(args[0], out shardId))
// {
// Console.Error.WriteLine("Invalid first argument (shard id): {0}", args[0]);
// return;
// }
//
// if (args.Length > 1)
// {
// if (!int.TryParse(args[1], out var shardCount))
// {
// Console.Error.WriteLine("Invalid second argument (total shards): {0}", args[1]);
// return;
// }
//
// totalShards = shardCount;
// }
// }
if (args.Length > 0 && args[0] != "run")
{
if (!int.TryParse(args[0], out shardId))
{
Console.Error.WriteLine("Invalid first argument (shard id): {0}", args[0]);
return;
}
if (args.Length > 1)
{
if (!int.TryParse(args[1], out var shardCount))
{
Console.Error.WriteLine("Invalid second argument (total shards): {0}", args[1]);
return;
}
totalShards = shardCount;
}
}
LogSetup.SetupLogger(shardId);
Log.Information("Pid: {ProcessId}", pid);