cron filters give a warning when theres an error in var1

This commit is contained in:
BroodjeAap 2022-12-19 20:29:11 +00:00
parent e694853366
commit 01f3393968
2 changed files with 27 additions and 19 deletions

View file

@ -15,6 +15,7 @@ import (
"github.com/andybalholm/cascadia"
"github.com/antchfx/htmlquery"
"github.com/robfig/cron/v3"
"github.com/tidwall/gjson"
lualibs "github.com/vadv/gopher-lua-libs"
lua "github.com/yuin/gopher-lua"
@ -72,6 +73,7 @@ func processFilters(filters []Filter, web *Web, watch *Watch, debug bool, schedu
}
if debug && filter.Type == "cron" {
processedMap[filter.ID] = true
getCronDebugResult(filter)
continue
}
if len(filter.Parents) == 0 && !debug {
@ -850,6 +852,13 @@ func triggerSchedule(watchID uint, web *Web, scheduleID *uint) {
processFilters(filters, web, watch, false, scheduleID)
}
func getCronDebugResult(filter *Filter) {
_, err := cron.ParseStandard(filter.Var1)
if err != nil {
filter.log(err)
}
}
func getFilterResultLua(filter *Filter) {
L := lua.NewState()
defer L.Close()

View file

@ -11,5 +11,4 @@
- log things to db for cron runs
- comments
- db prune job
- add var1 parsing test for cron jobs
- add full buildFilterTree/processFilters test