mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 01:28:13 -05:00
rename CronCoverSelf
to CronCoverAlertTrigger
This commit is contained in:
parent
13abf2af13
commit
a5ddafbd8b
@ -465,7 +465,7 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 计划任务类型不得使用触发服务器执行方式
|
// 计划任务类型不得使用触发服务器执行方式
|
||||||
if cr.TaskType == model.CronTypeCronTask && cr.Cover == model.CronCoverSelf {
|
if cr.TaskType == model.CronTypeCronTask && cr.Cover == model.CronCoverAlertTrigger {
|
||||||
err = errors.New("计划任务类型不得使用触发服务器执行方式")
|
err = errors.New("计划任务类型不得使用触发服务器执行方式")
|
||||||
c.JSON(http.StatusOK, model.Response{
|
c.JSON(http.StatusOK, model.Response{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
CronCoverIgnoreAll = iota
|
CronCoverIgnoreAll = iota
|
||||||
CronCoverAll
|
CronCoverAll
|
||||||
CronCoverSelf
|
CronCoverAlertTrigger
|
||||||
CronTypeCronTask = 0
|
CronTypeCronTask = 0
|
||||||
CronTypeTriggerTask = 1
|
CronTypeTriggerTask = 1
|
||||||
)
|
)
|
||||||
|
@ -3,9 +3,10 @@ package singleton
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jinzhu/copier"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/jinzhu/copier"
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/naiba/nezha/model"
|
"github.com/naiba/nezha/model"
|
||||||
@ -90,7 +91,7 @@ func CronTrigger(cr model.Cron, triggerServer ...uint64) func() {
|
|||||||
crIgnoreMap[cr.Servers[j]] = true
|
crIgnoreMap[cr.Servers[j]] = true
|
||||||
}
|
}
|
||||||
return func() {
|
return func() {
|
||||||
if cr.Cover == model.CronCoverSelf {
|
if cr.Cover == model.CronCoverAlertTrigger {
|
||||||
if len(triggerServer) == 0 {
|
if len(triggerServer) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user