# Constant Updating of Quueue

**URL:** <https://discuss.hangfire.io/t/constant-updating-of-quueue/6322>\
**Category:** bug?\
**Created:** [June 28, 2019, 7:29am UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322 "2019-06-28T07:29:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmt](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dmt](https://discuss.hangfire.io/u/dmt)\
**Post date:** [June 28, 2019, 7:29am UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322/1 "2019-06-28T07:29:26Z")

</div>

Hi

We are using v1.7.2 of hangfire on [ASP.Net](http://ASP.Net)

We noticed our database is getting hammered with Update hangfire.queue queries (multiple per second)

We have our server configured like this as per the documentation. If we change the QueuePollInterval to say a minute, it still seems to run every second.

Any ideas?

GlobalConfiguration.Configuration  
.SetDataCompatibilityLevel(CompatibilityLevel.Version\_170)  
.UseSimpleAssemblyNameTypeSerializer()  
.UseRecommendedSerializerSettings()  
.UseLog4NetLogProvider()  
.UseSqlServerStorage(GetConnectionString(), new SqlServerStorageOptions  
{  
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),  
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),  
QueuePollInterval = TimeSpan.Zero,  
UseRecommendedIsolationLevel = true,  
UsePageLocksOnDequeue = true,  
DisableGlobalLocks = true  
});

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [June 28, 2019, 4:10pm UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322/2 "2019-06-28T16:10:41Z")

</div>

Any chance the new configuration wasn’t propagated, or for some reason you are running Hangfire.SqlServer of version 1.7.0 on your server? You can increase `QueuePollInterval` to `TimeSpan.FromMilliseconds(500)` to have much fewer poll attempts, or use previous value.

---

<div class="post-metadata">

**Author:** ![dmt](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dmt](https://discuss.hangfire.io/u/dmt)\
**Post date:** [June 28, 2019, 9:32pm UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322/3 "2019-06-28T21:32:00Z")

</div>

I upgraded the application to use Hangfire.SqlServer 1.7.3 to see if that helped, but no joy.

The configuration is loaded during Application\_Startup.

I had a look at the source code too and I think there is the possibility of an infinite loop with the SlidingInvisibilityTimeout functionality.

I ended up setting this property to null on my config so that I can revert the system to using the old style of polling SQL server and I have set this to one minute. That got me out of trouble but I fear there is something sinister at play with that SlidingInvisibilityTimeout option.

GlobalConfiguration.Configuration  
.SetDataCompatibilityLevel(CompatibilityLevel.Version\_170)  
.UseSimpleAssemblyNameTypeSerializer()  
.UseRecommendedSerializerSettings()  
.UseLog4NetLogProvider()  
.UseSqlServerStorage(GetConnectionString(), new SqlServerStorageOptions  
{  
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),  
SlidingInvisibilityTimeout = null,  
QueuePollInterval = TimeSpan.FromMinutes(1),  
UseRecommendedIsolationLevel = true,  
UsePageLocksOnDequeue = true,  
DisableGlobalLocks = true  
});

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [June 29, 2019, 9:21am UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322/4 "2019-06-29T09:21:43Z")

</div>

Thanks for reporting this, @dmt. Yesterday I’ve released [Hangfire 1.7.4](https://github.com/HangfireIO/Hangfire/releases/tag/v1.7.4) where I’ve fixed one possibility that could end in such behaviour, however I wasn’t able to reproduce it. Now it will throw exceptions that will lead to a delay between loop iterations, but we still need to understand the cause.

Please see the commit description for more information – [https://github.com/HangfireIO/Hangfire/commit/591e8abbb189a4691c63669f212653f3c409c8f5](https://github.com/HangfireIO/Hangfire/commit/591e8abbb189a4691c63669f212653f3c409c8f5).

---

<div class="post-metadata">

**Author:** ![Xavier\_Jefferson](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/xavier_jefferson/32/1196_2.png) [@Xavier\_Jefferson](https://discuss.hangfire.io/u/Xavier_Jefferson)\
**Post date:** [June 30, 2019, 7:40am UTC](https://discuss.hangfire.io/t/constant-updating-of-quueue/6322/5 "2019-06-30T07:40:17Z")

</div>

By default, several background workers are going all at once, so the number of DB operations will be grow accordingly. I know this because I wrote and maintain the NHibernate-backed database provider. It’s very chatty!

Try finding the setting to cut down the background thread count. It’s late and I’m not inclined to dig for an example just now, but that may help.
