Skip to content

Commit 9d7fd91

Browse files
authored
Merge pull request #4 from CoreLayer/dev-0.0.3
Algorithm corrections + Metrics Server endpoint correction dev 0.0.3-3
2 parents 33edcb1 + dfb227d commit 9d7fd91

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/CoreLayer.Citrix.Adc.NodeBackup/CoreLayer.Citrix.Adc.NodeBackupWorker/Configuration/PrometheusMetricsServerConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Net;
2+
13
namespace CoreLayer.Citrix.Adc.NodeBackupWorker.Configuration
24
{
35
public class PrometheusMetricsServerConfiguration

src/CoreLayer.Citrix.Adc.NodeBackup/CoreLayer.Citrix.Adc.NodeBackupWorker/NodeBackupHostedService.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ public NodeBackupHostedService(IHostApplicationLifetime hostApplicationLifetime,
9090

9191
// Start embedded Prometheus MetricsServer
9292
if (!_nodeBackupConfiguration.Prometheus.MetricsServer.Enabled) return;
93-
_logger.LogInformation("Starting metrics server");
93+
_logger.LogInformation(
94+
"Starting metrics server on port {0}",
95+
_nodeBackupConfiguration.Prometheus.MetricsServer.Port);
9496
_metricServer = new MetricServer(
95-
hostname: "localhost",
9697
port: _nodeBackupConfiguration.Prometheus.MetricsServer.Port,
9798
useHttps: _nodeBackupConfiguration.Prometheus.MetricsServer.UseHttps);
9899
_metricServer.Start();
@@ -298,17 +299,14 @@ private long CalculateIntervalSecondsFromNowToBackupStart()
298299
_logger.LogDebug("Current time is before target start time");
299300
var nextTargetSeconds = (_nodeBackupConfiguration.Backup.Start.Ticks - DateTime.Now.Ticks) /
300301
TimeSpan.TicksPerSecond;
301-
302-
if (nextTargetSeconds > _nodeBackupConfiguration.Backup.Interval)
302+
303+
while (nextTargetSeconds > _nodeBackupConfiguration.Backup.Interval)
303304
{
304305
nextTargetSeconds -= _nodeBackupConfiguration.Backup.Interval;
305-
306-
_logger.LogDebug(
307-
"Seconds to next interval : {0}",
308-
nextTargetSeconds.ToString());
309306
}
310307

311308
nextTargetSeconds++;
309+
_logger.LogDebug("Seconds to next interval: {0}", nextTargetSeconds.ToString());
312310

313311
return nextTargetSeconds;
314312
}

0 commit comments

Comments
 (0)