mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
fix 定时任务管理
This commit is contained in:
@@ -104,6 +104,13 @@ func UpdateSchedule(id bson.ObjectId, item Schedule) error {
|
||||
return err
|
||||
}
|
||||
|
||||
node, err := GetNode(item.NodeId)
|
||||
if err != nil {
|
||||
log.Errorf("get node error: %s", err.Error())
|
||||
debug.PrintStack()
|
||||
return nil
|
||||
}
|
||||
item.NodeKey = node.Key
|
||||
if err := item.Save(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"crawlab/constants"
|
||||
"crawlab/model"
|
||||
"crawlab/services"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -49,9 +48,9 @@ func PostSchedule(c *gin.Context) {
|
||||
newItem.Id = bson.ObjectIdHex(id)
|
||||
|
||||
// 如果node_id为空,则置为空ObjectId
|
||||
if newItem.NodeId == "" {
|
||||
newItem.NodeId = bson.ObjectIdHex(constants.ObjectIdNull)
|
||||
}
|
||||
//if newItem.NodeId == "" {
|
||||
// newItem.NodeId = bson.ObjectIdHex(constants.ObjectIdNull)
|
||||
//}
|
||||
|
||||
// 更新数据库
|
||||
if err := model.UpdateSchedule(bson.ObjectIdHex(id), newItem); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user