maxiaoshan 3 năm trước cách đây
mục cha
commit
379c16939a
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      src/task.go

+ 7 - 1
src/task.go

@@ -580,12 +580,18 @@ func SaveResult() {
 					delYearMinCode = true
 				}
 			}
+			lock.Lock()
+			has := YearMinCodeMap[t.Code]
+			lock.Unlock()
 			if delYearMinCode {
+				lock.Lock()
 				delete(YearMinCodeMap, t.Code)
+				lock.Unlock()
 				go MgoE.Update("luayearmincode", map[string]interface{}{"code": t.Code}, map[string]interface{}{"$set": map[string]interface{}{"send": true}}, false, false)
-			} else if YearMinCodeMap[t.Code] { //luayearmincode中爬虫任务删除
+			} else if has { //luayearmincode中爬虫任务删除
 				return
 			}
+
 			result := map[string]interface{}{}
 			result["code"] = t.Code
 			result["site"] = t.Site