do not discover while printing

This commit is contained in:
EugeneTes
2026-01-27 11:55:57 +01:00
parent 43c118f527
commit bbe3a36c90
5 changed files with 42 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.4</Version>
<Version>1.0.5</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -67,10 +67,11 @@ public class PrinterDiscoveryBackgroundTask
private async Task DiscoverAndNotifyAsync()
{
_printServer.EnterDiscoveryLock();
try
{
var printers = await _discoveryService.DiscoverPrintersAsync(_discoveryTimeout);
var currentIps = printers.Select(p => p.IPAddress).ToHashSet();
foreach (string currentIp in currentIps)
@@ -90,6 +91,10 @@ public class PrinterDiscoveryBackgroundTask
{
_logger.LogWarning(ex, "Failed to discover printers");
}
finally
{
_printServer.ExitDiscoveryLock();
}
}
private bool HasConfigurationChanged(HashSet<string> currentIps)