Allows processing of empty chain addresses so roles can be cleaned up

This commit is contained in:
Ben 2025-04-17 16:06:34 +02:00
parent abdc7a0ab1
commit e8ef65d641
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
3 changed files with 1 additions and 19 deletions

View File

@ -30,10 +30,5 @@
{
return Hosts.Length > 0 || Clients.Length > 0;
}
public override string ToString()
{
return "Hosts:" + string.Join(",", Hosts) + "Clients:" + string.Join(",", Clients);
}
}
}

View File

@ -18,9 +18,7 @@ namespace BiblioTech.Rewards
public async Task ProcessChainActivity(ActiveChainAddresses activeChainAddresses)
{
if (!activeChainAddresses.HasAny()) return;
var activeUserIds = ConvertToUserIds(activeChainAddresses);
if (!activeUserIds.HasAny()) return;
if (!HasChanged(activeUserIds)) return;
await GiveAndRemoveRoles(activeUserIds);
@ -131,16 +129,6 @@ namespace BiblioTech.Rewards
public List<ulong> Hosts { get; }
public List<ulong> Clients { get; }
public bool HasAny()
{
return Hosts.Any() || Clients.Any();
}
public override string ToString()
{
return "Hosts:" + string.Join(",", Hosts) + "Clients:" + string.Join(",", Clients);
}
}
}
}

View File

@ -47,8 +47,7 @@ namespace TestNetRewarder
var numberOfChainEvents = await ProcessEvents(timeRange);
var duration = sw.Elapsed;
if (numberOfChainEvents == 0) return TimeSegmentResponse.Underload;
if (numberOfChainEvents > 10) return TimeSegmentResponse.Overload;
if (duration > TimeSpan.FromSeconds(1)) return TimeSegmentResponse.Underload;
if (duration > TimeSpan.FromSeconds(3)) return TimeSegmentResponse.Overload;
return TimeSegmentResponse.OK;
}