Skip to content

Commit e2cd704

Browse files
committed
fixed: set Hangfire JobStorage early to prevent errors when calling it before its server starts, version bumped to 1.34.1
1 parent fbc6467 commit e2cd704

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

Common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>1.34.0</VersionPrefix>
4+
<VersionPrefix>1.34.1</VersionPrefix>
55
</PropertyGroup>
66

77
<PropertyGroup>

Providers/AspNetCore/Revo.AspNetCore/Core/HangfireStartupConfigurator.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ public void ConfigureServices(IServiceCollection services)
2323
{
2424
var storage = hangfireConfigurationSection.JobStorage();
2525

26+
// this needs to be set here, otherwise Hangfire throws error when enqueuing a job
27+
// before IGlobalConfiguration has been first requested by the DI container
28+
GlobalConfiguration.Configuration.UseStorage(storage);
29+
2630
services
27-
.AddHangfire(globalCfg =>
31+
.AddHangfire(configuration =>
2832
{
29-
globalCfg.UseStorage(storage);
30-
33+
configuration.UseActivator(new HangfireJobActivator(kernel));
34+
3135
foreach (var action in hangfireConfigurationSection.ConfigurationActions)
3236
{
33-
action(globalCfg);
37+
action(configuration);
3438
}
35-
36-
globalCfg.UseNLogLogProvider();
37-
globalCfg.UseActivator(new HangfireJobActivator(kernel));
3839
});
3940

4041
if (hangfireConfigurationSection.AddHangfireServer)

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# RELEASE NOTES
22

3+
## [1.34.1] - 2023-04-04
4+
5+
### Fixed
6+
- set Hangfire JobStorage early to prevent errors when calling it before its server starts
7+
38
## [1.34.0] - 2023-03-17
49

510
### Changed

0 commit comments

Comments
 (0)