Hangfire.Atoms icon indicating copy to clipboard operation
Hangfire.Atoms copied to clipboard

Remove usage of JobStorage.Current

Open 0xced opened this issue 3 years ago • 3 comments

When using the ASP.NET Core Hangfire integration, i.e. services.AddHangfire(...) the JobStorage.Current static property may never be assigned through the application lifetime as it's injected.

We can get rid of JobStorage.Current and access the storage from either the new IBackgroundJobClientV2 interface introduced in Hangfire 1.8 (Atom + Trigger classes) or through the ApplyStateContext (AtomDeletedStateElectionFilter class).

Note that I have opened this pull request as a draft since it depends on Hangfire 1.8.0-rc2 which is not yet the final 1.8 version.

0xced avatar Dec 06 '22 09:12 0xced

Note: this pull request will be really useful when https://github.com/HangfireIO/Hangfire/pull/2146 will also be merged.

0xced avatar Dec 09 '22 08:12 0xced

Got it, ping me when it's ready

ahydrax avatar Dec 09 '22 08:12 ahydrax

Now that Hangfire 1.8 is released it might be worth considering.

0xced avatar May 25 '23 15:05 0xced