fix: 网元重启事件触发跟踪任务重发任务id对不上

This commit is contained in:
TsMask
2025-05-16 14:13:37 +08:00
parent 93890c4931
commit b34df2630a
3 changed files with 9 additions and 7 deletions

View File

@@ -202,8 +202,9 @@ func (r TraceTask) createTaskToNe(task *model.TraceTask, ignoreErr bool) error {
return fmt.Errorf("ne list is empty")
}
// 生成任务ID
traceId := r.traceTaskRepository.LastID() + 1 // 生成任务ID < 65535
task.TraceId = fmt.Sprint(traceId)
if task.TraceId == "" {
task.TraceId = fmt.Sprint(r.traceTaskRepository.LastID() + 1) // 生成任务ID < 65535
}
// 发送任务给网元
errNe := []string{}
@@ -331,8 +332,9 @@ func (r TraceTask) DeleteByIds(ids []int64) (int64, error) {
}
// RunUnstopped 启动跟踪未停止的任务
func (r TraceTask) RunUnstopped() {
tasks := r.traceTaskRepository.SelectByUnstopped()
func (r TraceTask) RunUnstopped(neType string, neId string) {
neStr := fmt.Sprintf("%s_%s", neType, neId)
tasks := r.traceTaskRepository.SelectByUnstopped(neStr)
for _, task := range tasks {
r.createTaskToNe(&task, true)
}