Skip to content

Feature Request: Schedule Jitter #88

@epicoxymoron

Description

@epicoxymoron

I might (and often do) have the following requirements:

  1. I want a job to run every 30 minutes.
  2. I don't care what the actual time of the execution is, i.e. I don't want/need every such job to run on the 0th and 30th minute of each hour. 14/44 or 22/52 would be fine.
  3. I'd really prefer that such jobs get spread out.

Prior art: Jenkins has this via a "special" letter H. I didn't realize how useful this was until I met Jenkins, and now I think it should be everywhere. The two basic formats supported are H and H/N for any N:

  1. H picks any value in the range, e.g. 0-59 for minutes/seconds, 0-23 for hours, etc.
  2. H/N describes an interval, e.g. H/15 could be 13/28/43/58 for minutes/seconds, H/8 could be 3/11/19 for hours, etc.. IMHO it should be highly recommended to use even divisors, and in their absence I think it's reasonable to not support "rollover memory", i.e. I don't think H/31 really needs to worry about firing at 00:00, 00:31, 01:02, 01:33, 02:04, 02:35, etc.

For expressions to be calculated reproducibly, they would need a seed. In the HangFire context, that's probably something like a recurringJobId. I'm not sure how you'd want that detail to cross project boundaries -- if you can provide some guidance on that, and this feature sounds like a good idea to you, I'm happy to work/collaborate on this.

If it's not something you'd want to support natively, I'd love any suggestions you might have on how this could be implemented from the outside.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions