-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/MongODM.Hangfire/Extensions/HangfireGlobalConfigExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Etherna.ExecContext.AsyncLocal; | ||
using Etherna.MongODM.HF.Filters; | ||
|
||
namespace Hangfire | ||
{ | ||
public static class HangfireGlobalConfigExtension | ||
{ | ||
#pragma warning disable IDE0060 // Remove unused parameter | ||
public static void UseMongODM(this IGlobalConfiguration config) | ||
#pragma warning restore IDE0060 // Remove unused parameter | ||
{ | ||
// Add a default execution context running with any Hangfire task. | ||
// Added because with asyncronous task, unrelated to requestes, there is no an alternative context to use with MongODM. | ||
GlobalJobFilters.Filters.Add(new AsyncLocalContextHangfireFilter(AsyncLocalContext.Instance)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters