mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Coordinator fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Grpc.AspNetCore" Version="2.41.0" />
|
<PackageReference Include="Grpc.AspNetCore" Version="2.44.0" />
|
||||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
||||||
|
@@ -114,14 +114,6 @@ namespace NadekoBot.Coordinator
|
|||||||
StartShard(shardId);
|
StartShard(shardId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.Process is null or {HasExited: true})
|
|
||||||
{
|
|
||||||
Log.Warning("Shard {ShardId} is starting (process)...", shardId);
|
|
||||||
hadAction = true;
|
|
||||||
StartShard(shardId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DateTime.UtcNow - status.LastUpdate >
|
if (DateTime.UtcNow - status.LastUpdate >
|
||||||
TimeSpan.FromSeconds(_config.UnresponsiveSec))
|
TimeSpan.FromSeconds(_config.UnresponsiveSec))
|
||||||
@@ -139,6 +131,24 @@ namespace NadekoBot.Coordinator
|
|||||||
StartShard(shardId);
|
StartShard(shardId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (status.Process is null or { HasExited: true })
|
||||||
|
{
|
||||||
|
Log.Warning("Shard {ShardId} is starting (process)...", shardId);
|
||||||
|
hadAction = true;
|
||||||
|
StartShard(shardId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
Log.Warning("Process for shard {ShardId} is bugged... ", shardId);
|
||||||
|
hadAction = true;
|
||||||
|
StartShard(shardId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,17 +171,13 @@ namespace NadekoBot.Coordinator
|
|||||||
var status = _shardStatuses[shardId];
|
var status = _shardStatuses[shardId];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (status.Process is { HasExited: false } p)
|
status.Process?.Kill(true);
|
||||||
{
|
}
|
||||||
try
|
catch
|
||||||
{
|
{
|
||||||
p.Kill(true);
|
}
|
||||||
}
|
try
|
||||||
catch
|
{
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
status.Process?.Dispose();
|
status.Process?.Dispose();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -282,8 +288,8 @@ namespace NadekoBot.Coordinator
|
|||||||
var status = _shardStatuses[shardId];
|
var status = _shardStatuses[shardId];
|
||||||
if (status.Process is { } p)
|
if (status.Process is { } p)
|
||||||
{
|
{
|
||||||
p.Kill();
|
try{p.Kill();} catch {}
|
||||||
p.Dispose();
|
try{p.Dispose();} catch {}
|
||||||
_shardStatuses[shardId] = status with
|
_shardStatuses[shardId] = status with
|
||||||
{
|
{
|
||||||
Process = null,
|
Process = null,
|
||||||
|
Reference in New Issue
Block a user