mirror of
https://github.com/tenrok/event-scheduling.git
synced 2026-06-20 20:00:38 +03:00
feat: schedule cron jobs
This commit is contained in:
@@ -32,11 +32,16 @@ func main() {
|
|||||||
|
|
||||||
scheduler := NewScheduler(db, eventListeners)
|
scheduler := NewScheduler(db, eventListeners)
|
||||||
|
|
||||||
|
stopCron := scheduler.StartCron()
|
||||||
|
defer stopCron()
|
||||||
|
|
||||||
scheduler.CheckEventsInInterval(ctx, time.Minute)
|
scheduler.CheckEventsInInterval(ctx, time.Minute)
|
||||||
|
|
||||||
scheduler.Schedule("SendEmail", "mail: nilkantha.dipesh@gmail.com", time.Now().Add(1*time.Minute))
|
scheduler.Schedule("SendEmail", "mail: nilkantha.dipesh@gmail.com", time.Now().Add(1*time.Minute))
|
||||||
scheduler.Schedule("PayBills", "paybills: $4,000 bill", time.Now().Add(2*time.Minute))
|
scheduler.Schedule("PayBills", "paybills: $4,000 bill", time.Now().Add(2*time.Minute))
|
||||||
|
|
||||||
|
scheduler.ScheduleCron("SendEmail", "mail: dipesh.dulal+new@wesionary.team", "* * * * *")
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for range interrupt {
|
for range interrupt {
|
||||||
log.Println("\n❌ Interrupt received closing...")
|
log.Println("\n❌ Interrupt received closing...")
|
||||||
|
|||||||
Reference in New Issue
Block a user