HangfireIO / HangfireIO/Hangfire

RecurringJob custom hash values

Open
#602 0 comments 2 reactions 0 assignees View on GitHub
a: core t: enhancement
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

I'm liking the new IRecurringJobManager and RecurringJobOptions approach to RecurringJobManager as of 1.6-beta3.
However I've recently found the need to add custom Hash values when creating a new RecurringJob which I then intercept via filters or just query directly.
I tried deriving from RecurringJobManager and overriding my own AddOrUpdate method but sadly I can't use ValidateCronExpression or _storage because they're marked as private, maybe sealing the class is a good idea if it's not meant to be inherited from.

Of course I can now implement my own IRecurringJobManager which I'm doing but I see the benefit of including something like this in the standard implementation as well, and I do have a couple of approaches in mind:
- Add something like a Dictionary(string, string) Property to RecurringJobOptions and then iterate over the key value pairs (if any) in RecurringJobManager.AddOrUpdate. Maybe even add this Dictionary to RecurringJobDto when we do GetRecurringJobs so we can quickly retrieve and use them.
- Something less invasive like opening up RecurringJobOptions for extension and making fields/methods protected instead of private. Maybe adding a simple virtual method that takes a RecurringJobOptions argument and returns a Dictionary that we then just call in AddOrUpdate.

I'd like to hear peoples thoughts on this. For now I'm writing my own IRecurringJobManager implementation to get by, although 90% of it will be identical to the standard RecurringJobManager. I'll be happy to submit a PR if you guys think this is worth having.

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.