Skip to content

Commit

Permalink
Fixed a NRE with queue base metrics polling
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Jan 31, 2025
1 parent f7524ee commit bee5d09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Foundatio/Queues/QueueBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ protected QueueBase(TOptions options) : base(options?.TimeProvider, options?.Log
var queueMetricValues = new InstrumentsValues<long, long, long>(() =>
{
if (options.MetricsPollingInterval > TimeSpan.Zero && _nextQueueStatsUpdate >= _timeProvider.GetUtcNow())
return (_queueStats.Queued, _queueStats.Working, _queueStats.Deadletter);
{
return _queueStats is not null ? (_queueStats.Queued, _queueStats.Working, _queueStats.Deadletter) : (0, 0, 0);
}

_nextQueueStatsUpdate = _timeProvider.GetUtcNow().UtcDateTime.Add(_options.MetricsPollingInterval);
try
Expand Down

0 comments on commit bee5d09

Please sign in to comment.