From 4cd22f3719aca6b38294e476d82801264a580f62 Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 1 Apr 2024 15:55:47 +0200 Subject: [PATCH] Rather embarrasing mistake in rewarderbot interval config param. --- .../CodexDiscordBotPlugin/DiscordBotStartupConfig.cs | 6 +++--- .../CodexDiscordBotPlugin/RewarderBotContainerRecipe.cs | 2 +- Tests/CodexTests/BasicTests/DiscordBotTests.cs | 2 +- Tools/TestNetRewarder/Configuration.cs | 2 +- Tools/TestNetRewarder/TimeSegmenter.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ProjectPlugins/CodexDiscordBotPlugin/DiscordBotStartupConfig.cs b/ProjectPlugins/CodexDiscordBotPlugin/DiscordBotStartupConfig.cs index dfc6ad1..bbef0b1 100644 --- a/ProjectPlugins/CodexDiscordBotPlugin/DiscordBotStartupConfig.cs +++ b/ProjectPlugins/CodexDiscordBotPlugin/DiscordBotStartupConfig.cs @@ -27,11 +27,11 @@ public class RewarderBotStartupConfig { - public RewarderBotStartupConfig(string discordBotHost, int discordBotPort, string interval, DateTime historyStartUtc, DiscordBotGethInfo gethInfo, string? dataPath) + public RewarderBotStartupConfig(string discordBotHost, int discordBotPort, string intervalMinutes, DateTime historyStartUtc, DiscordBotGethInfo gethInfo, string? dataPath) { DiscordBotHost = discordBotHost; DiscordBotPort = discordBotPort; - Interval = interval; + IntervalMinutes = intervalMinutes; HistoryStartUtc = historyStartUtc; GethInfo = gethInfo; DataPath = dataPath; @@ -39,7 +39,7 @@ public string DiscordBotHost { get; } public int DiscordBotPort { get; } - public string Interval { get; } + public string IntervalMinutes { get; } public DateTime HistoryStartUtc { get; } public DiscordBotGethInfo GethInfo { get; } public string? DataPath { get; set; } diff --git a/ProjectPlugins/CodexDiscordBotPlugin/RewarderBotContainerRecipe.cs b/ProjectPlugins/CodexDiscordBotPlugin/RewarderBotContainerRecipe.cs index 3be2f7f..816c910 100644 --- a/ProjectPlugins/CodexDiscordBotPlugin/RewarderBotContainerRecipe.cs +++ b/ProjectPlugins/CodexDiscordBotPlugin/RewarderBotContainerRecipe.cs @@ -17,7 +17,7 @@ namespace CodexDiscordBotPlugin AddEnvVar("DISCORDBOTHOST", config.DiscordBotHost); AddEnvVar("DISCORDBOTPORT", config.DiscordBotPort.ToString()); - AddEnvVar("INTERVALMINUTES", config.Interval); + AddEnvVar("INTERVALMINUTES", config.IntervalMinutes); var offset = new DateTimeOffset(config.HistoryStartUtc); AddEnvVar("CHECKHISTORY", offset.ToUnixTimeSeconds().ToString()); diff --git a/Tests/CodexTests/BasicTests/DiscordBotTests.cs b/Tests/CodexTests/BasicTests/DiscordBotTests.cs index eed7f48..6430923 100644 --- a/Tests/CodexTests/BasicTests/DiscordBotTests.cs +++ b/Tests/CodexTests/BasicTests/DiscordBotTests.cs @@ -47,7 +47,7 @@ namespace CodexTests.BasicTests //discordBotPort: botContainer.GetAddress(GetTestLog(), DiscordBotContainerRecipe.RewardsPort).Port, discordBotHost: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Host, discordBotPort: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Port, - interval: "60", + intervalMinutes: "1", historyStartUtc: GetTestRunTimeRange().From - TimeSpan.FromMinutes(3), gethInfo: gethInfo, dataPath: null diff --git a/Tools/TestNetRewarder/Configuration.cs b/Tools/TestNetRewarder/Configuration.cs index 02401d2..d19edb3 100644 --- a/Tools/TestNetRewarder/Configuration.cs +++ b/Tools/TestNetRewarder/Configuration.cs @@ -14,7 +14,7 @@ namespace TestNetRewarder public int DiscordPort { get; set; } = 31080; [Uniform("interval-minutes", "im", "INTERVALMINUTES", false, "time in minutes between reward updates. (default 15)")] - public int Interval { get; set; } = 15; + public int IntervalMinutes { get; set; } = 15; [Uniform("check-history", "ch", "CHECKHISTORY", true, "Unix epoc timestamp of a moment in history on which processing begins. Required for hosting rewards. Should be 'launch of the testnet'.")] public int CheckHistoryTimestamp { get; set; } = 0; diff --git a/Tools/TestNetRewarder/TimeSegmenter.cs b/Tools/TestNetRewarder/TimeSegmenter.cs index 4bdced2..d14bcc7 100644 --- a/Tools/TestNetRewarder/TimeSegmenter.cs +++ b/Tools/TestNetRewarder/TimeSegmenter.cs @@ -13,10 +13,10 @@ namespace TestNetRewarder { this.log = log; - if (configuration.Interval < 0) configuration.Interval = 15; + if (configuration.IntervalMinutes < 0) configuration.IntervalMinutes = 15; if (configuration.CheckHistoryTimestamp == 0) throw new Exception("'check-history' unix timestamp is required. Set it to the start/launch moment of the testnet."); - segmentSize = TimeSpan.FromSeconds(configuration.Interval); + segmentSize = TimeSpan.FromMinutes(configuration.IntervalMinutes); start = DateTimeOffset.FromUnixTimeSeconds(configuration.CheckHistoryTimestamp).UtcDateTime; log.Log("Starting time segments at " + start);