Skip to content

Commit

Permalink
Limit polling queries with a semaphore for all configurations
Browse files Browse the repository at this point in the history
Queries used for sliding invisibility timeout-based fetching are unified now, and we can use the same implementation for sub- and over second polling delay configured.

Possibly relates to HangfireIO#2120.
  • Loading branch information
odinserj committed Jun 7, 2024
1 parent 4bd4da9 commit 37736c0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Hangfire.SqlServer/SqlServerJobQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@ private SqlServerTimeoutJob DequeueUsingSlidingInvisibilityTimeout(string[] queu

try
{
if (useLongPolling)
{
semaphore = Semaphores.GetOrAdd(resource, CreateSemaphoreFunc);
semaphore.Wait(cancellationToken);
}
semaphore = Semaphores.GetOrAdd(resource, CreateSemaphoreFunc);
semaphore.Wait(cancellationToken);

while (!cancellationToken.IsCancellationRequested)
{
Expand Down

0 comments on commit 37736c0

Please sign in to comment.