cron filters give a warning when theres an error in var1
This commit is contained in:
parent
e694853366
commit
01f3393968
2 changed files with 27 additions and 19 deletions
|
@ -15,6 +15,7 @@ import (
|
||||||
|
|
||||||
"github.com/andybalholm/cascadia"
|
"github.com/andybalholm/cascadia"
|
||||||
"github.com/antchfx/htmlquery"
|
"github.com/antchfx/htmlquery"
|
||||||
|
"github.com/robfig/cron/v3"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
lualibs "github.com/vadv/gopher-lua-libs"
|
lualibs "github.com/vadv/gopher-lua-libs"
|
||||||
lua "github.com/yuin/gopher-lua"
|
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" {
|
if debug && filter.Type == "cron" {
|
||||||
processedMap[filter.ID] = true
|
processedMap[filter.ID] = true
|
||||||
|
getCronDebugResult(filter)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(filter.Parents) == 0 && !debug {
|
if len(filter.Parents) == 0 && !debug {
|
||||||
|
@ -850,6 +852,13 @@ func triggerSchedule(watchID uint, web *Web, scheduleID *uint) {
|
||||||
processFilters(filters, web, watch, false, scheduleID)
|
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) {
|
func getFilterResultLua(filter *Filter) {
|
||||||
L := lua.NewState()
|
L := lua.NewState()
|
||||||
defer L.Close()
|
defer L.Close()
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -11,5 +11,4 @@
|
||||||
- log things to db for cron runs
|
- log things to db for cron runs
|
||||||
- comments
|
- comments
|
||||||
- db prune job
|
- db prune job
|
||||||
- add var1 parsing test for cron jobs
|
|
||||||
- add full buildFilterTree/processFilters test
|
- add full buildFilterTree/processFilters test
|
Loading…
Add table
Reference in a new issue