Skip to content

Commit

Permalink
Merge pull request #4 from CoreLayer/dev-0.0.3
Browse files Browse the repository at this point in the history
Algorithm corrections + Metrics Server endpoint correction dev 0.0.3-3
  • Loading branch information
jantytgat authored Jun 12, 2020
2 parents 33edcb1 + dfb227d commit 9d7fd91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Net;

namespace CoreLayer.Citrix.Adc.NodeBackupWorker.Configuration
{
public class PrometheusMetricsServerConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ public NodeBackupHostedService(IHostApplicationLifetime hostApplicationLifetime,

// Start embedded Prometheus MetricsServer
if (!_nodeBackupConfiguration.Prometheus.MetricsServer.Enabled) return;
_logger.LogInformation("Starting metrics server");
_logger.LogInformation(
"Starting metrics server on port {0}",
_nodeBackupConfiguration.Prometheus.MetricsServer.Port);
_metricServer = new MetricServer(
hostname: "localhost",
port: _nodeBackupConfiguration.Prometheus.MetricsServer.Port,
useHttps: _nodeBackupConfiguration.Prometheus.MetricsServer.UseHttps);
_metricServer.Start();
Expand Down Expand Up @@ -298,17 +299,14 @@ private long CalculateIntervalSecondsFromNowToBackupStart()
_logger.LogDebug("Current time is before target start time");
var nextTargetSeconds = (_nodeBackupConfiguration.Backup.Start.Ticks - DateTime.Now.Ticks) /
TimeSpan.TicksPerSecond;

if (nextTargetSeconds > _nodeBackupConfiguration.Backup.Interval)
while (nextTargetSeconds > _nodeBackupConfiguration.Backup.Interval)
{
nextTargetSeconds -= _nodeBackupConfiguration.Backup.Interval;

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

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

return nextTargetSeconds;
}
Expand Down

0 comments on commit 9d7fd91

Please sign in to comment.