feature:#150 added slog and changed signatures

This commit is contained in:
Elmar Kresse
2024-01-21 17:53:49 +01:00
parent a9e76ee3db
commit 031fa717d7
9 changed files with 77 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ import (
"htwkalender/service/feed"
"htwkalender/service/fetch/sport"
"htwkalender/service/functions/time"
"log/slog"
)
func AddSchedules(app *pocketbase.PocketBase) {
@@ -19,17 +20,20 @@ func AddSchedules(app *pocketbase.PocketBase) {
// Every three hours update all courses (5 segments - minute, hour, day, month, weekday) "0 */3 * * *"
// Every 10 minutes update all courses (5 segments - minute, hour, day, month, weekday) "*/10 * * * *"
scheduler.MustAdd("updateCourse", "0 */3 * * *", func() {
slog.Info("Started updating courses schedule")
course.UpdateCourse(app)
})
// Every sunday at 3am clean all courses (5 segments - minute, hour, day, month, weekday) "0 3 * * 0"
scheduler.MustAdd("cleanFeeds", "0 3 * * 0", func() {
// clean feeds older than 6 months
slog.Info("Started cleaning feeds schedule")
feed.ClearFeeds(app.Dao(), 6, time.RealClock{})
})
// Every sunday at 2am fetch all sport events (5 segments - minute, hour, day, month, weekday) "0 2 * * 0"
scheduler.MustAdd("fetchEvents", "0 2 * * 0", func() {
slog.Info("Started fetching sport events schedule")
sport.FetchAndUpdateSportEvents(app)
})