This versions adds possibility to use non-transactional message fetching algorithm when using Hangfire.SqlServer package. This is especially helpful, if you have a lot of long-running background jobs, since they may prevent you from taking transaction log backups, leading to the Transaction log is full due to ‘ACTIVE_TRANSACTION’ error.

The new implementation is based on the old invisibility timeout, but workers are now periodically renewing that timeout, so you can forget about setting too high timeout just to allow your long-running background jobs to run smoothly. Non-transactional fetch is not enabled by default in this version (and will not be in 1.7.0 to preserve backward compatibility), to configure it please use the SlidingInvisibilityTimeout option as written below.

Lower values will stress your database (for example, if it is set to 5 minutes, each worker will run a keep-alive query each minute when processing a job), higher values will add a corresponding delay, when processing is terminated ungracefully.

GlobalConfiguration.Configuration.UseSqlServerStorage(
    "connection_string", 
    new SqlServerStorageOptions { SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5) });

Hangfire.SqlServer

  • AddedSqlServerStorageOptions.SlidingInvisibilityTimeout to fetch jobs without using transaction.
  • Fixed – Transaction log is full due to ‘ACTIVE_TRANSACTION’ by allowing to use new non-transactional fetch (when using SlidingInvisibilityTimeout option).
  • FixedSqlServerJobQueueMonitoringApi can’t cause READ UNCOMMITTED isolation level to leak on SQL Server 2012 or earlier.
  • Fixed – Add missing SqlServerStorage(DbConnection, SqlServerStorageOptions) constructor.

Subscribe to monthly updates

Subscribe to receive monthly blog updates. Very low traffic, you are able to unsubscribe at any time.

Comments