Skip to content

Commit 26ab8e3

Browse files
authored
Don't have evert Servie log when Redis is down (#702)
1 parent 9a595aa commit 26ab8e3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/Halibut/Queue/Redis/RedisPendingRequestQueue.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Halibut.Transport.Protocol;
1818
using Halibut.Util;
1919
using Nito.AsyncEx;
20+
using StackExchange.Redis;
2021

2122
namespace Halibut.Queue.Redis
2223
{
@@ -521,10 +522,15 @@ await Task.WhenAny(
521522
{
522523
if (!queueToken.IsCancellationRequested)
523524
{
524-
log.WriteException(EventType.Error, "Error occured dequeuing from the queue", ex);
525+
// If redis is down, don't log when dequeuing work since every polling service will log the issue every ~30s.
526+
if (ex is not RedisConnectionException)
527+
{
528+
log.WriteException(EventType.Error, "Error occured dequeuing from the queue", ex);
529+
}
530+
525531
// It is very likely a queue error means every tentacle will return an error.
526532
// Add a random delay to help avoid every client coming back at exactly the same time.
527-
await Task.Delay(TimeSpan.FromSeconds(new Random().Next(15)), cts.Token);
533+
await Task.Delay(TimeSpan.FromSeconds(new Random().Next(halibutTimeoutsAndLimits.PollingQueueWaitTimeout.Seconds)), cts.Token);
528534
}
529535
throw;
530536
}

0 commit comments

Comments
 (0)