Quartz.NET Scheduler & Cron
Source:
Scheduler.cs+AttendancePostService.cs
Scheduler Architecture
Cron Expression Breakdown
Cron: "0/30 * 7-23 * * ?"
┌─── Second: 0/30 → Every 30 seconds (0, 30)
│ ┌─ Minute: * → Every minute
│ │ ┌ Hour: 7-23 → Between 7:00 AM and 11:59 PM
│ │ │ ┌ Day: * → Every day of month
│ │ │ │ ┌ Month: * → Every month
│ │ │ │ │ ┌ DOW: ? → Any day of week
│ │ │ │ │ │
0/30 * 7-23 * * ?Execution Timeline
What Each Execution Does
Service Lifecycle
| Event | Action | Method |
|---|---|---|
| Windows Service Start | Initialize Quartz scheduler, configure cron trigger, start firing | Scheduler.Run() |
| Every 30 seconds (7AM-11PM) | Execute PunchTimingsJob → process all attendance | PunchTimingsJob.Execute() |
| Windows Service Stop | Gracefully shutdown Quartz scheduler | Scheduler.Stop() |
Why every 30 seconds? The service continuously re-processes attendance so that any new biometric punches or mobile check-ins are immediately reflected in the daily attendance records. This means an employee who punches in at 10:15 AM will have their attendance calculated within 30 seconds.