Roc 2 жил өмнө
parent
commit
23d134491f

+ 3 - 1
controllers/base_from_calculate.go

@@ -545,7 +545,6 @@ func (this *CalculateController) Refresh() {
 	br := new(models.BaseResponse).Init()
 	var cacheKey string
 	defer func() {
-		utils.Rc.Delete(cacheKey)
 		this.Data["json"] = br
 		this.ServeJSON()
 	}()
@@ -576,6 +575,9 @@ func (this *CalculateController) Refresh() {
 	cacheKey = utils.CACHE_EDB_DATA_REFRESH + strconv.Itoa(edbInfo.Source) + "_" + req.EdbCode
 	if !utils.Rc.IsExist(cacheKey) {
 		utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
+		defer func() {
+			utils.Rc.Delete(cacheKey)
+		}()
 
 		startDate := req.StartDate
 		var errMsg string