This is a maintenance release that contains important fixes for the Hangfire.SqlServer package to avoid deadlocks if you have long-running jobs, improvements for background process dispatch loop’s implementation, and also an interesting experimental feature that can transparently make background job creation resilient to transient exceptions by using idempotent retries.

The new feature is especially useful for cloud environments to avoid duplicated job creation on different network “blips”, ongoing storage maintenance and so on. Previously, the simplest way to handle an exception in this case is to try to create a background job once again, but there’s a chance that previous attempt was actually succeeded – consider a timeout that happens while transmitting a successful response.

So we’ll have two background jobs instead of one. But now BackgroundJobClient is able to make idempotent retries to ensure we are creating only a single job even in case of multiple retry attempts. And you can enable this feature by setting its RetryAttempts property to a some positive value.

var backgroundJobs = new BackgroundJobClient { RetryAttempts = 3 };
backgroundJobs.Enqueue(() => Console.WriteLine("Hello, world"));

Hangfire.Core

  • AddedBackgroundJobClient.RetryAttempts property to make job creation resilient to transient exceptions.
  • Added – Dashboard localization support in pt-BR (by @candidodmv).
  • Changed – Protect background dispatchers from moving from stopped state to non-stopped one.
  • Changed – Unify WaitOne and WaitOneAsync methods with timeout and cancellation token for WaitHandle class.
  • Fixed – Don’t hide an original fatal exception occurred in dispatchers in some cases.
  • Fixed – Dashboard UI to display “await” keyword on all task-like methods.
  • Fixed – Display links properly in an informational message on the Servers page in Dashboard UI.
  • Fixed – Wait for the heartbeat process before shutting down a server.

Hangfire.SqlServer

  • Fixed – Potential deadlocks cause by suboptimal queries when using SlidingInvisibilityTimeout fetching.
  • Fixed – Prevent zero delays between fetch retry attempts when lock acquisition failed without blocking.
  • Fixed – Specify float precision explicitly for the Score column in the AddToSet method.

Subscribe to monthly updates

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

Comments