This commit is contained in:
Даниил Заикин
2026-06-17 20:44:53 +03:00
parent 9d153773c2
commit b133e7c656
1880 changed files with 244545 additions and 0 deletions
@@ -0,0 +1,25 @@
using System;
using System.IO;
using SingularityGroup.HotReload.Editor.Cli;
namespace SingularityGroup.HotReload.Editor {
public class ServerHealthCheck : IServerHealthCheckInternal {
private static readonly TimeSpan heartBeatTimeout = TimeSpan.FromMilliseconds(5000);
internal static readonly IServerHealthCheckInternal instance = new ServerHealthCheck();
public static IServerHealthCheck I => instance;
public static TimeSpan HeartBeatTimeout => heartBeatTimeout;
ServerHealthCheck() { }
/// <summary>
/// Whether or not the server is running and responsive
/// </summary>
public bool IsServerHealthy { get; private set; }
void IServerHealthCheckInternal.CheckHealth() {
var fi = new FileInfo(Path.Combine(CliUtils.GetCliTempDir(), "health"));
IsServerHealthy = fi.Exists && DateTime.UtcNow - fi.LastWriteTimeUtc < heartBeatTimeout;
}
}
}