Skip to content

Commit 9349e64

Browse files
committed
Don't immediatly check the request was collected
1 parent dd989f2 commit 9349e64

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

source/Halibut/Queue/Redis/NodeHeartBeat/NodeHeartBeatWatcher.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ static async Task WaitForRequestToBeCollected(
134134

135135
while (!cancellationToken.IsCancellationRequested)
136136
{
137+
await Try.IgnoringError(async () =>
138+
{
139+
await Task.WhenAny(
140+
Task.Delay(timeBetweenCheckingIfRequestWasCollected, cancellationToken),
141+
redisPending.WaitForRequestToBeMarkedAsCollected(cancellationToken));
142+
});
143+
144+
if(cancellationToken.IsCancellationRequested) break;
145+
137146
try
138147
{
139148
// Has something else determined the request was collected?
@@ -156,13 +165,6 @@ static async Task WaitForRequestToBeCollected(
156165
{
157166
log.WriteException(EventType.Diagnostic, "Error checking if request {0} is still on queue", ex, request.ActivityId);
158167
}
159-
160-
await Try.IgnoringError(async () =>
161-
{
162-
await Task.WhenAny(
163-
Task.Delay(timeBetweenCheckingIfRequestWasCollected, cancellationToken),
164-
redisPending.WaitForRequestToBeMarkedAsCollected(cancellationToken));
165-
});
166168
}
167169

168170
log.Write(EventType.Diagnostic, "Stopped waiting for request {0} to be collected (cancelled)", request.ActivityId);

0 commit comments

Comments
 (0)