Update MainForm.cs, HeartbeatClient.cs

This commit is contained in:
Namhyeon Go 2024-10-04 15:09:05 +09:00
parent 86916d2ed9
commit 641c2070a4
2 changed files with 8 additions and 3 deletions

View File

@ -211,7 +211,10 @@ namespace WelsonJS.Launcher
private void userdefinedVariablesToolStripMenuItem_Click(object sender, EventArgs e) private void userdefinedVariablesToolStripMenuItem_Click(object sender, EventArgs e)
{ {
(new EnvForm()).Show(); using (var envForm = new EnvForm())
{
envForm.Show();
}
} }
} }
} }

View File

@ -16,7 +16,7 @@ namespace WelsonJS.Service
{ {
private readonly HeartbeatService.HeartbeatServiceClient _client; private readonly HeartbeatService.HeartbeatServiceClient _client;
private readonly GrpcChannel _channel; private readonly GrpcChannel _channel;
private const int HeartbeatInterval = 2000; // 2 seconds private int HeartbeatInterval;
private ServiceMain _parent; private ServiceMain _parent;
private string clientId; private string clientId;
private string serverAddress; private string serverAddress;
@ -25,6 +25,8 @@ namespace WelsonJS.Service
{ {
_parent = (ServiceMain)parent; _parent = (ServiceMain)parent;
HeartbeatInterval = int.Parse(_parent.GetSettingsHandler().Read("HEARTBEAT_INTERVAL", "Service") ?? "2000");
try try
{ {
serverAddress = _parent.GetSettingsHandler().Read("GRPC_HOST", "Service"); serverAddress = _parent.GetSettingsHandler().Read("GRPC_HOST", "Service");
@ -69,7 +71,7 @@ namespace WelsonJS.Service
await call.RequestStream.CompleteAsync(); await call.RequestStream.CompleteAsync();
_parent.Log("Sent heartbeat"); _parent.Log("Sent heartbeat");
await Task.Delay(HeartbeatInterval); // HeartbeatInterval 동안 대기 await Task.Delay(HeartbeatInterval); // Wait for HeartbeatInterval
} }
catch (Exception ex) catch (Exception ex)