mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-03 14:03:09 +00:00
Check connection no more than once every 30 seconds
This commit is contained in:
parent
23b7bbd548
commit
a6fce1084d
@ -1,5 +1,4 @@
|
||||
using ArgsUniform;
|
||||
using GethConnector;
|
||||
using Logging;
|
||||
using Utils;
|
||||
|
||||
@ -12,6 +11,7 @@ namespace TestNetRewarder
|
||||
public static CancellationToken CancellationToken { get; private set; }
|
||||
public static BotClient BotClient { get; private set; } = null!;
|
||||
private static Processor processor = null!;
|
||||
private static DateTime lastCheck = DateTime.MinValue;
|
||||
|
||||
public static Task Main(string[] args)
|
||||
{
|
||||
@ -65,6 +65,9 @@ namespace TestNetRewarder
|
||||
private static async Task EnsureBotOnline()
|
||||
{
|
||||
var start = DateTime.UtcNow;
|
||||
var timeSince = start - lastCheck;
|
||||
if (timeSince.TotalSeconds < 30.0) return;
|
||||
|
||||
while (! await BotClient.IsOnline() && !CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
@ -77,6 +80,8 @@ namespace TestNetRewarder
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
|
||||
lastCheck = start;
|
||||
}
|
||||
|
||||
private static void PrintHelp()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user