hummingbird-project / swift-jobs

Offload work your server would be doing to another server
Apache License 2.0
15 stars 2 forks source link

Job scheduler service #5

Closed adam-fowler closed 2 months ago

adam-fowler commented 3 months ago

New Service to schedule jobs at specific times

let jobSchedule = JobSchedule([
    (job: SundayCleanupJob(), schedule: .weekly(day: .sunday, hour: 4)),
    (job: BirthdayJob(), schedule: .yearly(month: .march, date: 4)),
])
let serviceGroup = ServiceGroup(
    configuration: .init(
        services: [jobQueue, jobSchedule.scheduler(on: jobQueue)]
    )
)
adam-fowler commented 2 months ago

Added stored metadata to queue and using this to store last date job was queued.

Also added an accuracy parameter to job schedules which indicates how accurately the schedule should be followed if we fall behind.

These changes also require changes to the job drivers to support jobqueue metadata