Skip to content

Remove usage of JobStorage.Current#10

Open
0xced wants to merge 3 commits into
ahydrax:masterfrom
0xced:IBackgroundJobClientV2
Open

Remove usage of JobStorage.Current#10
0xced wants to merge 3 commits into
ahydrax:masterfrom
0xced:IBackgroundJobClientV2

Conversation

@0xced

@0xced 0xced commented Dec 6, 2022

Copy link
Copy Markdown
Contributor

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

0xced commented Dec 9, 2022

Copy link
Copy Markdown
Contributor Author

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

@ahydrax

ahydrax commented Dec 9, 2022

Copy link
Copy Markdown
Owner

Got it, ping me when it's ready

@ahydrax ahydrax self-requested a review December 9, 2022 08:50
@0xced 0xced force-pushed the IBackgroundJobClientV2 branch from b51eb1e to 2cddd5c Compare December 9, 2022 09:06
0xced added 3 commits May 25, 2023 17:48
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).
@0xced 0xced force-pushed the IBackgroundJobClientV2 branch from 2cddd5c to f1024d3 Compare May 25, 2023 15:53
@0xced

0xced commented May 25, 2023

Copy link
Copy Markdown
Contributor Author

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

@0xced 0xced marked this pull request as ready for review May 25, 2023 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants