Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of JobStorage.Current #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Dec 6, 2022

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
Copy link
Contributor Author

0xced commented Dec 9, 2022

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

@ahydrax
Copy link
Owner

ahydrax commented Dec 9, 2022

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
Copy link
Contributor Author

0xced commented May 25, 2023

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