Skip to content

Introduce start-delay #10

Open
Open
@d-t-w

Description

@d-t-w

We can start a simple schedule anytime (e.g. every 60s) but we don't currently support starting a simple schedule with a delay. We do support starting at a specific point in time, but a delay is much more useful.

You can get around this in code, e.g. this starts a 1m recurring job that begins in one minute.

Would be better to just do this from config with :start-delay

  (let [period  (* 1 60000)
        trigger ^TriggerBuilder (cronut/trigger-builder {:type      :simple
                                                         :interval  period
                                                         :time-unit :millis
                                                         :repeat    :forever
                                                         :misfire   :fire-now})
        start   (Date. ^Long (+ (System/currentTimeMillis) period))] ;; introduce cronut start-delay configuration
    {:job     (reify Job
                (execute [_ _]
                  (try (do-thing) (catch Exception _ (log/error "thing error")))))
     :trigger (.startAt trigger start)}))

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