Skip to content

Commit

Permalink
make interfaces public
Browse files Browse the repository at this point in the history
  • Loading branch information
dangershony committed Nov 10, 2023
1 parent 52b4789 commit 03d02f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/Angor/Client/Services/NetworkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ namespace Angor.Client.Services
{
public interface INetworkService
{
Task CheckServices();
Task CheckServices(bool force = false);

SettingsUrl GetPrimaryIndexer();
SettingsUrl GetPrimaryRelay();
List<SettingsUrl> GetRelays();
}

public class NetworkService : INetworkService
Expand All @@ -27,13 +29,13 @@ public NetworkService(INetworkStorage networkStorage, HttpClient httpClient, ILo
_logger = logger;
}

public async Task CheckServices()
public async Task CheckServices(bool force = false)
{
var settings = _networkStorage.GetSettings();

foreach (var indexerUrl in settings.Indexers)
{
if ((DateTime.UtcNow - indexerUrl.LastCheck).Minutes > 1)
if (force || (DateTime.UtcNow - indexerUrl.LastCheck).Minutes > 10)
{
indexerUrl.LastCheck = DateTime.UtcNow;

Expand Down Expand Up @@ -61,7 +63,7 @@ public async Task CheckServices()

foreach (var relayUrl in settings.Relays)
{
if ((DateTime.UtcNow - relayUrl.LastCheck).Minutes > 1)
if (force || (DateTime.UtcNow - relayUrl.LastCheck).Minutes > 1)
{
relayUrl.LastCheck = DateTime.UtcNow;

Expand Down
2 changes: 1 addition & 1 deletion src/Angor/Client/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
// Convert the version to a string
softwareVersion = version.ToString();

_timer = new Timer(TimerElapsed, null, TimeSpan.Zero, TimeSpan.FromMinutes(1)); // Tick every 1 min
_timer = new Timer(TimerElapsed, null, TimeSpan.Zero, TimeSpan.FromMinutes(5)); // Tick every 5 min
}

protected override async Task OnInitializedAsync()
Expand Down

0 comments on commit 03d02f0

Please sign in to comment.