27 lines
764 B
C#
27 lines
764 B
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace StellaOps.Scanner.Worker.Processing;
|
|
|
|
public sealed class NullScanJobSource : IScanJobSource
|
|
{
|
|
private readonly ILogger<NullScanJobSource> _logger;
|
|
private int _logged;
|
|
|
|
public NullScanJobSource(ILogger<NullScanJobSource> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public Task<IScanJobLease?> TryAcquireAsync(CancellationToken cancellationToken)
|
|
{
|
|
if (Interlocked.Exchange(ref _logged, 1) == 0)
|
|
{
|
|
_logger.LogWarning("No queue provider registered. Scanner worker will idle until a queue adapter is configured.");
|
|
}
|
|
|
|
return Task.FromResult<IScanJobLease?>(null);
|
|
}
|
|
}
|