Hangfire是一个开源且商业免费使用的工具函数库
Hangfire是一个开源且商业免费使用的工具函数库。可以让你非常容易地在ASP.NET应用(也可以不在ASP.NET应用)中执行多种类型的后台任务,而无需自行定制开发和管理基于Windows Service后台任务执行器。且任务信息可以被持久保存Release Notes
Hangfire.Core
- Changed – Produce a trace log message with details when updating a recurring job.
- Changed – Return early from
CoreBackgroundJobFactory.Create
when storage returnsnull
. - Project – Minor changes for the
Readme.md
file (PR #1526 by @231293). - Project – Add
netcoreapp3.0
target framework for Hangfire.Core.Tests. - Project – Add support for MSBuild 15.0 (VS 2019) when building
*.cshtml
files.
Dashboard UI
- Added – Allow modification of the Dashboard UI title (PR #1231 by @tbertenshaw).
- Added – Support for HTML tags on the Dashboard UI title (PR #1545 by @caioproiete).
- Added – Buttons for 1,000 and 5,000 items per page in dashboard (#1518).
- Added – Links to previous/next pages to the top of the dashboard page (#1534).
- Changed – Expose the
RazorPage.Context
property as a public member. - Fixed – Supplementary Chinese translation (PR ##1523 by @mccj).
- Fixed – Don't update real-time chart when too much time passed since the last update (#1497).
Hangfire.SqlServer
- Added – Add support for Microsoft.Data.SqlClient package when using custom connection factory (#1514).
- Added – Add
UseFineGrainedLocks
option to avoid deadlocks in some theoretical cases. - Added – Add missing overload for
UseSqlServerStorage
with connection factory parameter only. - Added – Expose the SqlServerObjectsInstaller.GetInstallScript method (PR #1527 by @altso).
- Fixed – Make command batching working on .NET Core when using System.Data.SqlClient 4.7.0 and higher.
- Fixed – Permit dash characters (
-
) in schema names (PR #1531 by @kendaleiv). - Fixed – Escape square bracket characters in schema names.
- Project – Add support for
netcoreapp3.0
target in Hangfire.SqlServer.Tests. - Project – Take schema name from constant in Hangfire.SqlServer.Tests (PR #1532 by @kendaleiv).
- Project – Make Hangfire.SqlServer.Tests work on Linux in Travis CI environment.
Hangfire.AspNetCore
Assets
3
Release Notes
Hangfire.Core
- Changed – Add support for dash characters (
-
) in queue names (PR #1469 by @caioproiete). - Fixed – Show actual error in Dashboard UI when recurring job can't be scheduled.
- Fixed – Ensure backward compatibility when JSON payloads are serialized with field names only.
- Fixed – Non-awaited continuations can bring down the whole app when
TaskScheduler
is set tonull
. - Fixed – Timeout value is not respected in some cases in the
WaitOneAsync
method.
Assets
3
Release Notes
Hangfire.Core
- Fixed – Show error message when there's an error loading the statistics in Dashboard UI (PR #1242 by @prochnowc).
- Fixed – Properly handle recurring jobs with null or empty 'Job' field.
- Fixed – Disable recurring job when we can't schedule it due to an error.
- Fixed – Use
LazyThreadSafetyMode.PublicationOnly
to avoid caching "JobStorage.Current is null" exceptions.
Hangfire.AspNetCore & Hangfire.NetCore
- Fixed – Add missing overload for the
AddHangfireServer
method with "options" action.
Assets
3
Release Notes
Hangfire.Core
- Added –
BackgroundJobClient.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
andWaitOneAsync
methods with timeout and cancellation token forWaitHandle
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 theAddToSet
method.
Assets
3
Release Notes
This version contains security fixes to prevent possible XSS attacks as described in #1441. They don't relate to user data submitted to Hangfire directly via method arguments, but it's recommended to upgrade anyway. If you are using Hangfire 1.6, please upgrade to version 1.6.26 instead.
- Affected Packages
- Hangfire.Core ≤ 1.6.25, 1.7.0, 1.7.1, 1.7.2
- Affected Platforms
- All, including .NET Core, .NET Framework, Mono of any version
Steps to reproduce
public static void Xss()
{
BackgroundJob.Enqueue(() => Xss2());
}
public static void Xss2()
{
throw new Exception("<script>alert(1);</script>");
}
Hangfire.Core
- SECURITY – Use
HtmlEncode
in all remaining places in Dashboard UI to prevent XSS attacks. - Added – Added Dutch language, and updated missing translation on "Servers" page (by @r-win).
- Added –
Cron.Never
method for adding manual recurring jobs that never fire (by @michaltalaga). - Fixed – Add missing
AddOrUpdate
extension methods for theIRecurringJobManager
interface. - Deprecated – Unused
HtmlHelper.FormatProperties
method is now obsolete.
Hangfire.SqlServer
- Fixed – Wrong error message in migration script, when @CurrentSchemaVersion has a NULL value (by @penenkel).
Reporting security issues
In order to give the community time to respond and upgrade we strongly urge you report all security issues privately. Please email us at support@hangfire.io with details and we will respond ASAP. Security issues always take precedence over bug fixes and feature work. We can and do mark releases as "urgent" if they contain serious security fixes.
Assets
3
Release Notes
Hangfire.Core
- Added –
DashboardOptions.TimeZoneResolver
property to handle custom time zone resolvers in Dashboard UI. - Fixed –
RecurringJob.AddOrUpdate
method is now able to update a broken recurring job. - Fixed – Recurring job scheduler now properly handles recurring jobs whose job method or time zone is wrong.
- Fixed – Don't throw an exception on Recurring Jobs page when time zone can't be resolved.
Hangfire.AspNetCore & Hangfire.NetCore
- Added – Automatically resolve
ITimeZoneResolver
service for theDashboardOptions.TimeZoneResolver
property. - Fixed – Allow to resolve
IJobFilterProvider
service from theAddHangfire
method.
Hangfire.SqlServer
- Fixed – Occasional "DataException: Error parsing column" error when using blocking fetch.
Assets
3
Release Notes
Please see https://docs.hangfire.io/en/latest/upgrade-guides/upgrading-to-hangfire-1.7.html to learn how to upgrade to 1.7.X.
This is a patch release that adds some nice features for Dashboard UI, knows how to deal with recurring jobs with invalid Cron expressions, and contains some minor improvements for SQL Server storage. Also, Hangfire.NetCore
package was added to support new .NET Core Worker Service applications without referencing any ASP.NET Core packages.
Hangfire.Core
- Added –
DashboardOptions.IgnoreAntiforgeryToken
property to disable token validation in Dashboard UI. - Added – Display hints regarding server status on Servers page in Dashboard UI.
- Added – Highlight recurring jobs with no next execution in Dashboard UI.
- Added – Show actual error in Dashboard UI when recurring job has an invalid Cron expression.
- Fixed –
InvalidOperationException
whenAllowSynchronousIO
option isn't set in ASP.NET Core 3.0. - Fixed – Set
NextExecution
value tonull
when existing recurring job has an invalid Cron expression. - Fixed – Make dashboard charts to be more culture-specific to use correct time format.
- Fixed – Obsolete
UseSerializationSettings
comment now contains correct method name (by @PaitoAnderson). - Project –
resx
files now re-generated automatically when building a project.
Hangfire.NetCore
- Added – Worker Service host support for .NET Core without unnecessary dependencies to ASP.NET Core.
Hangfire.SqlServer
- Changed – Use blocking fetch implementation only for sub-second polling intervals.
- Fixed – Don't fail with an exception when can't connect to MS SQL instance during start-up.
- Fixed – Don't access the
JobQueue
table when using blocking query and don't have results.
Assets
3
Release Notes
Hangfire.Core
- Fixed – Buggy
CancellationToken
consumers now can't cause memory leaks related to token registrations.
Assets
3
Release Notes
Please see the Upgrading to Hangfire 1.7 article to learn more about the upgrade steps.
Hangfire.Core
- Added – Full .NET Core 2.0 support by explicitly targeting .NET Standard 2.0.
- Added –
IGlobalConfiguration.SetDataCompatibilityLevel
to enable rolling upgrades from version 1.6. - Added –
IGlobalConfiguration.UseRecommendedSerializerSettings
method for new installations. - Added – Assemblies now loaded automatically when resolving a type when using default type resolver.
- Added – Custom
TaskScheduler
can now be specified inBackgroundJobServerOptions
for workers. - Added –
IdempotentCompletionAttribute
filter to enforce strict order for continuations. - Added –
IBackgroundJobClient.ContinueJobWith
methods to replaceContinueWith
ones in future for clarity. - Added –
JobStorage.LinearizableReads
virtual property to avoid unnecessary waits in state changer. - Added – Allow async methods to run their continuations on worker thread by disabling
TaskScheduler
. - Added – Multi-stage shutdown to wait for graceful completion before starting to abort jobs.
- Added – Asynchronous checks for job cancellation,
IJobCancellationToken
can be replaced withCancellationToken
(by @pieceofsummer). - Added – Possibility to create millions of recurring jobs without stressing the scheduler.
- Added – Second-based recurring jobs are fully supported now with 6-part cron expressions.
- Added – Support for custom
TimeZoneInfo
resolvers in recurring jobs for interoperability purposes. - Added – Package now explicitly targets .NET Standard 2.0, and .NET Framework 4.6 target added as well.
- Added – Type roundtrip support between .NET Core and .NET Framework for most common types.
- Added – Allow to specify queue names based on job arguments with
QueueAttribute
via patterns. - Added –
PerformContext.Storage
property to allow server filters to spawn connections. - Added –
GetFirstByLowestScoreFromSet
connection method overload that returns multiple items (by @cdschneider). - Added – Entry point for custom job naming strategies available for dashboard (by @pieceofsummer).
- Added –
JobDisplayNameAttribute
class for displaying jobs in dashboard, available on .NET Core (by @pieceofsummer). - Added – Support for async jobs returning ValueTask<T> (by @pieceofsummer).
- Added – Support for asynchronous background processes, opens the road toward async storage.
- Added – Circuit breaker pattern for background processes to reduce the logging pressure.
- Added – Processing server is now able to detect it was expired, and restart itself with the new id.
- Added – Ability to use custom delays for automatic retries of a background job.
- Added –
ThreadAbortException
andThreadInterruptedException
handling to keep the background process running. - Added – Support for complex Cron expressions, including the
L
,W
,#
characters. - Added –
JobActivator.BeginScope
method overload with the fullPerformContext
(by @jeroenvervaeke). - Added – Support for read-only view for dashboard (by @mikechamberlain).
- Added – Storage property to control the job expiration time (by @rsilvanet).
- Added – Decrease the size of serialized type payloads and remove version information.
- Changed – Make
TaskScheduler.Default
the default scheduler for async jobs to avoid breaking changes. - Changed – Split serializer setting to Internal and User scopes to isolate them (Version_170 Switch).
- Changed – Don't allow to affect internal serialization even by
JsonConvert.DefaultSettings
(Version_170 Switch). - Changed – Share the same type binder between Hangfire itself and Newtonsoft.Json (Version_170 Switch).
- Changed – Use more compact representation of dates when using
SerializeDateTime
(Version_170 Switch). - Changed – Stop using special case for
DateTime
argument serialization (Version_170 Switch). - Changed – Don't serialize unused
AwaitingState.Expiration
field (Version_170 Switch). - Changed – Specify parameter type when serializing arguments to allow using
TypeNameHandling.Auto
option. - Changed – Use case sensitive search when resolving a type as by default in .NET.
- Changed – Make
SucceededState
constructor public to allow state serialization. - Changed – Add
IBackgroundJobFactory.StateMachine
property (breaking change for low level API). - Changed – Replace Rickshaw with Chart.js to have beautiful charts with less headache.
- Changed –
DelayedJobScheduler
is able to use the new storage method to query multiple jobs at once. - Changed –
RecurringJobScheduler
now uses index-based checks to fetch only those jobs that should be scheduled. - Fixed – Worker now logs an error, when all the state change attempts failed due to an exception.
- Fixed – Don't serialize arguments multiple times when showing job details in dashboard.
- Fixed –
DateTimeOffset
conversion error when it was serialized withTypeConverter
. - Fixed – Remove duplicate of argument deserialization code for obsolete
Job
class methods. - Fixed – Decorate all the exceptions with the
SerializableAttribute
. - Fixed –
ArgumentNullException
when job class contains method with non-resolvable generic arguments. - Fixed – "Failed to initialize CoreCLR" error, by removing reference to
Microsoft.NETCore.Portable.Compatibility
. - Fixed – Possible race conditions in
RecurringJobScheduler
that may lead to job duplicates. - Fixed – Configuration inconsistency introduced in 1.6.18 leading to issues with custom
JobActivator
. - Fixed – Triggering the recurring task doesn't update its last execution time.
- Fixed – Recurring job which don't have next execution (intentionally or not) don't cause exception.
- Fixed – Dashboard recurring jobs sorting is random (now it's based on next execution time).
- Fixed – Performance problems with huge amount of recurring jobs.
- Fixed –
NextExecution
field of a recurring job has delay in value getting set. - Fixed – Dashboard graphs have improper sizing.
- Fixed – Server disappears from the list, but still performing the background processing.
- Fixed – Logging is too aggressive on transient errors.
- Fixed – Daylight saving time transitions now handled perfectly in recurring jobs thanks to Cronos.
- Fixed – Confusing Cron scheduling, when both day-of-week and day-of-month fields set.
- Project – Add
DataCompatibilityRangeFact
andDataCompatibilityRangeTheory
classes for compatibility checks. - Project – Reduce test execution time by removing unnecessary waits.
Hangfire.AspNetCore
- Added – Full .NET Core 2.0 support by explicitly targeting .NET Standard 2.0.
- Added – An overloaded AddHangfire method with
IServiceProvider
parameter (by @ericgreenmix and @denis-ivanov). - Added –
BackgroundJobServerHostedService
class based onIHostedService
interface. - Added –
IServiceCollection.AddHangfireServer
method to register the server during configuration. - Changed – Custom services for factory, performer and state changer interfaces will be picked up only when all of them registered.
Hangfire.SqlServer
- Added – Full .NET Core 2.0 support by explicitly targeting .NET Standard 2.0.
- Added –
Schema 7
migration to fix theIX_HangFire_Set_Score
index to include theKey
column. - Added –
Schema 6
migration with less indexes, better physical layout andbigint
support (disabled by default). - Added – Blocking fetch support for sliding expiration-based fetch to avoid excessive polling.
- Added –
SqlServerStorageOptions.EnableHeavyMigrations
switch to automatically install even heavy migrations. - Added –
SqlServerStorageOptions.DisableGlobalLocks
property to avoid custom locking scheme. - Added –
SqlServerStorageOptions.UsePageLocksOnDequeue
property to use less CPU consuming fetch. - Added – Callback method to allow to open the database with impersonation (by @BjoernHund).
- Added –
SqlServerStorageOptions.UseRecommendedIsolationLevel
option to set the minimum possible level. - Changed – Identity columns either converted to the
bigint
type, or entirely removed. - Changed – Clustered indexes were organized according to the access patterns of their tables.
- Changed – Most of secondary indexes were either removed or made filtered.
- Changed – Optimize sliding-expiration-based fetching to use even less CPU time.
- Changed – Use write reordering and fine-grained locking scheme to improve parallelism.
- Changed – Monitoring API doesn't check state data to see state transition time.
- Changed – Allow to use zero-based poll interval when sliding invisibility timeout.
- Changed – Short paths for the
CreateExpiredJob
method to avoid some round-trips. - Changed – Set
SqlParameter
types explicitly to not to duplicate query plans. - Changed – Batch support for
AddToQueue
method when default provider is used. - Changed – Check
FetchedAt
has expected value to prevent prolonging others' work. - Changed – Use more recent Dapper 1.50.7 on all platforms except .NET Framework 4.5.
- Changed – Dapper package is internalized now even on .NET Core to avoid possible conflicts.
- Fixed – Avoid unnecessary waits in state changer when job was already expired.
- Fixed – Cannot resolve the collation conflict in
CountersAggregator
. - Fixed – Background processing stops when identity columns exceed the
Int32.MaxValue
. - Fixed – Slowdown of scheduled jobs due to the missing index on the
[Set]
table.
Assets
3
Release Notes
Hangfire.Core
- Fixed –
PreserveCulture
filter logs a message instead of throwing an error when it can't find the culture. - Fixed – Uninitialized continuation shouldn't cause exception when completing an antecedent job.
Hangfire.SqlServer
- Fixed – Validate
JobExpirationCheckInterval
option to avoid exceptions in runtime (PR #1377 by @carlowahlstedt). - Fixed – Don't throw an exception, when current schema version is higher than expected.
Assets
3
Release Notes
This is the second release candidate of the upcoming version 1.7.0 that fixes some issues and avoids some breaking changes. Please see the Upgrading to Hangfire 1.7 article to learn more about the upgrade steps.
Hangfire.Core
- Changed – Allow
IdempotentCompletion
filter to move a job to non-final and non-processing states. - Changed – Make
TaskScheduler.Default
the default scheduler for async jobs to avoid breaking changes. - Changed – Increase delays between continuation state fetch attempts to reduce storage load.
- Changed – Avoid breaking changes in
BackgroundJobServer
andRecurringJobScheduler
classes. - Changed – Add
IBackgroundJobFactory.StateMachine
property (breaking change for low level API). - Fixed – Deadlock in async methods when
ConfigureAwait(false)
is used (regression in RC 1).
Hangfire.AspNetCore
- Changed – Allow to use registered custom low-level classes like
IBackgroundJobFactory
again. - Fixed –
NullReferenceException
when application is stopped due to an exception during the start.
Hangfire.SqlServer
- Fixed – Don't use clustered index on table variable in
CountersAggregator
, works only in MSSQL 2014. - Fixed – Don't use the
CONCAT
function in migration script, works only in MSSQL 2012.
Assets
3
Release Notes
This is the first (and hopefully last) release candidate of version 1.7 that adds a lot of new features and improvements and allows rolling upgrades from version 1.6.X and below. Detailed migration guide will be posted in the documentation next week, but the point of this release is to disable by default all the changes that are incompatible with 1.6 installations.
Upgrading from beta versions
If you are upgrading from 1.7.0 betas, upgrade all the servers first to the newest rc1
version and only then use add the following configuration lines to turn on the new features that were disabled by default in this release candidate. Please note that CompatibilityLevel.Version_170
contains some changes that your existing 1.7.0-beta servers may not understand.
GlobalConfiguration.Configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170) // Compact data representation
.UseSimpleAssemblyNameTypeSerializer() // Compact type serialization format
If you are using SQL Server as a job storage, set the following settings if you were using 1.7.0 betas just after updating the package. These settings are the same that were enabled by default for beta versions, so your existing servers are compatible with them.
.UseSqlServerStorage("connection_string", new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5)
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero, // Set only when using SlidingInvisibilityTimeout
DisableGlobalLocks = true, // Set only if `Schema 6` migration is applied
UsePageLocksOnDequeue = true // Set only if `Schema 6` migration is applied
})
Hangfire.Core
- Added –
IGlobalConfiguration.SetDataCompatibilityLevel
to enable rolling upgrades from version 1.6. - Added –
IGlobalConfiguration.UseRecommendedSerializerSettings
method for new installations. - Added – Assemblies now loaded automatically when resolving a type when using default type resolver.
- Added – Custom
TaskScheduler
can now be specified inBackgroundJobServerOptions
for workers. - Added –
IdempotentCompletionAttribute
filter to enforce strict order for continuations. - Added –
IBackgroundJobClient.ContinueJobWith
methods to replaceContinueWith
ones in future for clarity. - Added –
JobStorage.LinearizableReads
virtual property to avoid unnecessary waits in state changer. - Changed – Split serializer setting to Internal and User scopes to isolate them (Version_170 Switch).
- Changed – Don't allow to affect internal serialization even by
JsonConvert.DefaultSettings
(Version_170 Switch). - Changed – Share the same type binder between Hangfire itself and Newtonsoft.Json (Version_170 Switch).
- Changed – Use more compact representation of dates when using
SerializeDateTime
(Version_170 Switch). - Changed – Stop using special case for
DateTime
argument serialization (Version_170 Switch). - Changed – Don't serialize unused
AwaitingState.Expiration
field (Version_170 Switch). - Changed – Use custom
SynchronizationContext
for async methods to run their continuations on worker thread. - Changed – Specify parameter type when serializing arguments to allow using
TypeNameHandling.Auto
option. - Changed – Use case sensitive search when resolving a type as by default in .NET.
- Changed – Make
SucceededState
constructor public to allow state serialization. - Fixed – Worker now logs an error, when all the state change attempts failed due to an exception.
- Fixed – Ensure
RecurringJobScheduler
doesn't go into infinite loop when there's server of an older version. - Fixed – Implement
BackgroundTaskScheduler.MaximumConcurrencyLevel
property. - Fixed – Dashboard renderer for
AwaitingState
displaysOption
property as string again. - Fixed – Don't serialize arguments multiple times when showing job details in dashboard.
- Fixed –
DateTimeOffset
conversion error when it was serialized withTypeConverter
. - Fixed – Remove duplicate of argument deserialization code for obsolete
Job
class methods. - Fixed – Decorate all the exceptions with the
SerializableAttribute
. - Project – Add
DataCompatibilityRangeFact
andDataCompatibilityRangeTheory
classes for compatibility checks. - Project – Reduce test execution time by removing unnecessary waits.
- Ported – Merged updates from version 1.6.23.
Hangfire.AspNetCore
- Changed – Remove internal service registrations that are inconsistent with server options.
- Ported – Merged updates from version 1.6.23.
Hangfire.SqlServer
- Added –
SqlServerStorageOptions.EnableHeavyMigrations
switch to automatically install even heavy migrations. - Added –
Schema 7
migration to fix theIX_HangFire_Set_Score
index to include theKey
column. - Added –
SqlServerStorageOptions.DisableGlobalLocks
property to avoid custom locking scheme. - Added –
SqlServerStorageOptions.UsePageLocksOnDequeue
property to use less CPU consuming fetch. - Changed –
Schema 6
migration is disabled by default for existing installations, because it may take too long. - Changed – Don't throw an exception when using automatic migrations and current schema is newer than expected.
- Changed – Store arguments in the corresponding column in SQL Server again.
- Changed – Continue to use global locks by default in SQL Server storage.
- Changed – Bring
ExpirationManager
andCountersAggregator
to their previous state. - Changed – Monitoring API doesn't check state data to see state transition time.
- Changed – Update
CountersAggregator
to use clustered key for temp table. - Fixed – Avoid unnecessary waits in state changer when job was already expired.
- Fixed – Cannot resolve the collation conflict in
CountersAggregator
. - Ported – Merged updates from version 1.6.23.
Assets
3
Release Notes
Hangfire.Core
- Changed –
StopTimeout
introduced in 1.7.0-beta3 now defaults to zero seconds (2ca6fc4). - Fixed –
NotSupportedException
thrown byRecurringJobScheduler
(regression, 001ee08). - Fixed –
NotSupportedException
thrown byDelayedJobScheduler
(regression, 3c2ec58). - Fixed –
RecurringJobManager.AddOrUpdate
method doesn't preserveLastJobId
(regression, 4748d7e). - Fixed – Cache results of the
IsBatchingAvailable
method per connection type (6dc93e8).
Assets
3
Release Notes
Hangfire.Core
- Added – Multi-stage shutdown to wait for graceful completion before starting to abort jobs.
- Added – Asynchronous checks for job cancellation,
IJobCancellationToken
can be replaced withCancellationToken
(PR #976 by @pieceofsummer). - Added – Possibility to create millions of recurring jobs without stressing the scheduler.
- Added – Second-based recurring jobs are fully supported now with 6-part cron expressions (#167, #1262).
- Added – Support for custom
TimeZoneInfo
resolvers in recurring jobs for interoperability purposes. - Added – Package now explicitly targets .NET Standard 2.0, and .NET Framework 4.6 target added as well (PR #1309).
- Added – Type round-trip support between .NET Core and .NET Framework for most common types.
- Added – Allow to specify queue names based on job arguments with
QueueAttribute
via patterns. - Added –
PerformContext.Storage
property to allow server filters to spawn connections. - Added –
GetFirstByLowestScoreFromSet
connection method overload that returns multiple items (PR #1251 by @cdschneider). - Changed – New type serialization is disabled by default for compatibility reasons.
- Changed – Cronos package upgraded to 0.7.0 and internalized even on .NET Standard platforms.
- Changed – Replace Rickshaw with Chart.js to have beautiful charts with less headache (PR #1315).
- Changed –
DelayedJobScheduler
is able to use the new storage method to query multiple jobs at once (PR #1330, #38). - Changed –
RecurringJobScheduler
now uses index-based checks to fetch only those jobs that should be scheduled (PR #1334). - Fixed –
ArgumentNullException
when job class contains method with non-resolvable generic arguments. - Fixed – Re-add missing fonts as embedded resources due to a regression appeared in 1.7.0-beta2.
- Fixed – "Failed to initialize CoreCLR" error, by removing reference to
Microsoft.NETCore.Portable.Compatibility
(#982, #1074). - Fixed – Intermittent
JsonSerializationException
in .NET Core 2.0 (#1214). - Fixed – Possible race conditions in
RecurringJobScheduler
that may lead to job duplicates. - Fixed – Configuration inconsistency introduced in 1.6.18 leading to issues with custom
JobActivator
. - Fixed – Backward compatibility issue with type serialization when
TypeNameHandling.All
is used. - Fixed – Triggering the recurring task doesn't update its last execution time (#233).
- Fixed – Recurring job which don't have next execution (intentionally or not) don't cause exception.
- Fixed – Dashboard recurring jobs sorting is random (now it's based on next execution time, #391, #791).
- Fixed – Performance problems with huge amount of recurring jobs (#449).
- Fixed –
NextExecution
field of a recurring job has delay in value getting set. (#843) - Fixed – Dashboard graphs have improper sizing (#1011).
- Ported – Merged updates from version 1.6.21 and 1.6.22.
Hangfire.AspNetCore
- Added – Full .NET Core 2.0 support by explicitly targeting .NET Standard 2.0.
- Added –
BackgroundJobServerHostedService
class based onIHostedService
interface (#962). - Added – IServiceCollection.AddHangfire extension method to register the server during configuration.
Hangfire.SqlServer
- Changed – Short paths for the CreateExpiredJob method to avoid some round-trips.
- Changed – Allow to use zero-based poll interval when sliding invisibility timeout.
- Changed – Set
SqlParameter
types explicitly to not to duplicate query plans. - Changed – Batch support for
AddToQueue
method when default provider is used (PR #1331). - Changed – Check
FetchedAt
has expected value to prevent prolonging others' work. - Changed – Use more recent Dapper 1.50.7 on all platforms except .NET Framework 4.5.
- Changed – Dapper package is internalized now even on .NET Core to avoid possible conflicts.
- Ported – Merged updates from versions 1.6.21 and 1.6.22.
Assets
3
Release Notes
Hangfire.Core
- Added – Ability to use custom type resolvers to modify the type de-serialization logic.
- Fixed –
JobLoadException
when processing jobs in .NET Framework, which were created in .NET Core. - Fixed –
JobLoadException
when jobs reside in a signed assembly and a new version is deployed. - Fixed – Don't produce extra logging message when there's an exception in a worker (#1304).
- Fixed – Ensure form values are properly returned when there are different versions of Microsoft.Owin (#1329 by @DC-jc, #1324).
- Fixed – Dashboard fails with 404 "Not Found" error if there's a trailing slash for some reason (#1086).
Hangfire.SqlServer
- Added – Connection factory overload for the
SqlServerStorage
class (#1325 by @chinwobble). - Fixed – Inability to use package with Azure's managed service identity (by using a connection factory, #1323).
Release Notes
This is a maintenance release with minor changes.
Hangfire.Core
- Fixed – High CPU usage and long response time when accessing Failed jobs page with Linux stack traces.
- Fixed –
RecurringJobScheduler
may block server shutdown and cause distributed lock to be abandoned.
Hangfire.SqlServer
- Fixed – Change locking scheme in the
Connection.SetRangeInHash
method to avoid deadlocks.
Hangfire.AspNetCore
- Fixed – Null-based implementation of the
IAntiforgery
interface doesn't lead to an exception.
Release Notes
This release contains fixes for security issues related to dashboard, so it is highly recommended to upgrade. Cross-Site Request Forgery protection was added by using existing libraries, but methods are different across application frameworks:
- For ASP.NET Core, no additional configuration is required, since
Microsoft.AspNetCore.Antiforgery
package is used to generate and validate tokens. Dependency injection is used to obtain the implementation and apply it when available. - For other frameworks, additional configuration is required based on an abstract
IOwinDashboardAntiforgery
interface, because the available implementation is tightly coupled with theSystem.Web.Helpers
assembly. Please check this gist to learn how to enable antiforgery token validation on ASP.NET and ASP.NET MVC platforms.
Other important updates include a new retry implementation for state changes in the Worker
class to avoid any reads and writes whenever it is possible for a job's distributed lock to be abandoned, because it may lead to consistency issues. Transitions directly to the Failed state without applying the job filters were also disabled, because such a behavior is not a determined one.
Also, looks like waiting on CancellationToken.WaitHandle
rarely leads to high CPU usage. I was unable to reveal the exact reason for this, but any other implementation, including using Task.Delay
or own tandem of CancellationToken.Register
with ManualResetEvent
works fine without such issues.
Hangfire.Core
-
SECURITY – Add "robots" meta tag to ensure browser don't index dashboard pages.
-
SECURITY – Add support for antiforgery validation to prevent CSRF attacks (requires configuration).
-
Fixed – Perform state change retries using a fresh connection when job's distributed lock may be abandoned
-
Fixed – Disallow transitions to the Failed state on retries that bypass all the filters
-
Fixed – Remove possible rare CPU spikes due to the use of
CancellationToken.WaitHandle
-
Fixed – Avoid resolving types and methods for logging in static constructors that may lead to process shutdown
-
Fixed – Prevent Recurring jobs dashboard from throwing
NullReferenceException
(#1203 by @mattkwiecien) -
Fixed – Replace wall clocks with monotonic ones when calculating local timeouts
-
Fixed – Change logger initialization to be deterministic and predictable by using instance fields
-
Fixed – Make
_currentLogProvider
field access to use volatile reads/writes -
Fixed – Typo in
NotSupportedException
's message (#1210 by @benrick) -
Fixed – Typo on the Failed jobs page (#1207 by @gareth-evans)
Hangfire.SqlServer
- Fixed – Remove the synthetic limitation to support Azure SQL Management instance (#1222, #1230 by @TimSQL)
Hangfire.AspNetCore
- SECURITY – Use ASP.NET Core's built-in antiforgery validation to prevent CSRF attacks
Release Notes
Hangfire.Core
- Fixed – NullReferenceException in JobMethodCallRenderer regression appeared in 1.6.18.
Hangfire.SqlServer
- Fixed – "String or binary data would be truncated" exception when state reason is too long.
- Fixed – Command handling in batch mode now stops after the first error due to "XACT_ABORT ON".
- Fixed – Make
SqlCommandBatch
disposable to dispose all the commands.
Release Notes
This release contains a lot of fixes, but the most important ones are related to .NET Core and ASP.NET Core frameworks. Filters based on attributes are now working fine there, and DisplayName
decoration will finally bring the human-ready name for your jobs. Other fixes are mostly related to dashboard.
Hangfire.Core
- Added – Add on option to remove the storage connection string from the footer (PR #1079 by @sandorfr).
- Added – Add Dashboard UI Resource zh-TW (PR #1105 by @crablin).
- Fixed – OutOfMemoryException in dashboard when arguments are too big (#1051, PR #1153).
- Fixed – DisplayNameAttribute doesn't work when using dashboard in .NET Core (PR #1154).
- Fixed – Update rickshaw css to match the js version (PR #1018 by @pieceofsummer).
- Fixed – Bad exception when Job.FromExpression fails to resolve method for explicit interface implementations (#1050, PR #1056 by @f00).
- Fixed – Missing intValue-values in "/stats" endpoint (PR #1152 by @pieceofsummer).
- Fixed – Logging doesn't work with log4net integration in .NET Core (#1095, PR #1134 by @evollu).
- Fixed – Fix nuspec pointing to version of Newtonsoft.Json that does not exist (#947, #973, PR #1083 by @mvestergaard)
- Fixed – Server start time has a bad tooltip position (PR #1029 by @pieceofsummer).
- Fixed – Prevent connection string from blowing mobile page layout (PR #1030 by @pieceofsummer).
- Fixed – Number of recurring jobs per page is now correct (PR #1006 by @pieceofsummer).
- Project – Get rid of all the compile-time warnings (PR #1058 by @liakamp).
- Project – More details for build instructions for the project (PR #1055 by @kristofferjalen).
- Project – Unable to build project with space in folder path (#809, PR #1057 by @stefanviberg).
Hangfire.AspNetCore
- Added – More Hangfire-related services are now registered in an IoC container (PR #800 by @pieceofsummer).
- Fixed – Queue parameter is ignored in .NET Core when creating a job (#799, PR #800 by @pieceofsummer).
- Fixed – Fix issue with configuration block not called on .NET Core (PR #800 by @pieceofsummer).
Hangfire.SqlServer
1.7.0-beta1
odinserj released this
Release Notes
This is a preview of the next release that contains important changes in a lot of subsystems. A completely new background processing engine introduced with support for both synchronous and asynchronous processes while using the same model. While processing is still not asynchronous, because storage methods aren't (see #1116 planning for 1.8.0), it's a great step forward.
After dealing with a lot of daylight saving time transition issues, we've decided to build a completely new library to work with cron expression. So the Cronos project was born contains first-class support for time zones and knows about all the subtleties.
And last but not least, it contains major upgrades to the Hangfire.SqlServer package with the new optimized schema with much fewer indexes, and identity columns upgraded to the bigint
type for those, who processed 2,147,483,647 background jobs.
Hangfire.Core
- Added – Entry point for custom job naming strategies available for dashboard (PR #660 by @pieceofsummer).
- Added –
JobDisplayNameAttribute
class for displaying jobs in dashboard, available on .NET Core (PR #993 by @pieceofsummer). - Added – Support async jobs returning
ValueTask<T>
and otherawait
-compatible types (PR #974 by @pieceofsummer). - Added – Support for asynchronous background processes, opens the road toward async storage (PR #1082, #150).
- Added – Circuit breaker pattern for background processes to reduce the logging pressure (PR #1082).
- Added – Processing server is now able to detect it was expired, and restart itself with the new id (PR #1082).
- Added – Ability to use custom delays for automatic retries of a background job (PR #931).
- Added –
ThreadAbortException
andThreadInterruptedException
handling to keep the background process running (PR #1082). - Added – Support for complex Cron expressions, including the
L
,W
,#
characters (PR #853, #494). - Added –
JobActivator.BeginScope
method overload with the full PerformContext (PR #995 by @jeroenvervaeke, #828). - Added – Support for read-only view for dashboard (PR #934 by @mikechamberlain, #423, #758).
- Added – Storage property to control the job expiration time (PR #913 by @rsilvanet).
- Changed – Decrease the size of serialized payloads and remove version information (PR #891).
- Fixed – Server disappears from the list, but still performing the background processing (#796, #1123).
- Fixed – Logging is too aggressive on transient errors (#542).
- Fixed – Daylight saving time transitions now handled perfectly in recurring jobs thanks to Cronos (#567).
- Fixed – Confusing Cron scheduling, when both day-of-week and day-of-month fields set (#979).
Hangfire.SqlServer
- Added – Callback method to allow to open the database with impersonation (PR #907 by @BjoernHund).
- Changed – Identity columns either converted to the
bigint
type, or entirely removed (PR #898). - Changed – Clustered indexes were organized according to the access patterns of their tables (PR #898).
- Changed – Most of secondary indexes were either removed or made filtered (PR #898).
- Fixed – Background processing stops when identity columns exceed the
Int32.MaxValue
(#749). - Fixed – Slowdown of scheduled jobs due to the missing index on the
Set
table (#844).
Watchers:320 |
Star:5290 |
Fork:1208 |
创建时间: 2013-08-06 17:43:04 |
最后Commits: 4天前 |
2ec8344
Release Notes
Hangfire.Core
IGlobalConfiguration.UseResultsInContinuations
method to globally enable results for continuations.ContinuationsSupport
.JobParameterInjectionFilter
server filter to inject job parameters as arguments.UseBackgroundPool
methods.CultureInfo.InvariantCulture
is now restored properly in background jobs.null
value is skipped when displaying job arguments in Dashboard UI.System.Diagnostics.Debug
type in .NET Core 3.0.JobActivatorScope.InnerScope
property as it wasn't implemented.Hangfire.SqlServer
System.Data.SqlClient
dependency fromSqlCommandBatch
andExpirationManager
.Hangfire.AspNetCore
IAppBuilder.MapHangfireDashboard
method for ASP.NET Core 3.0 endpoint routing (by @kendaleiv).netcoreapp3.0
target with "Microsoft.AspNetCore.App" framework reference (by @stebueh).Hangfire.NetCore
netcoreapp3.0
target with reference to "3.0.0" packages.Documentation