| | |
| | | var cacheMod models.Cache |
| | | cacheItems, _ := cacheMod.FindAll() |
| | | |
| | | logger.Debug("Start resend task. cache len:%d", len(cacheItems)) |
| | | for _, c := range cacheItems { |
| | | if !util.SendData([]byte(c.Data), config.ForwardConf.SyncServer) { |
| | | c.UpdateRetryCount() |
| | |
| | | func SendData(payload []byte, url string) bool { |
| | | body, err := HttpPost(url, nil, payload) |
| | | if err != nil { |
| | | logger.Error("Post request failure, url:%s, err:%s", err.Error()) |
| | | logger.Error("Post request failure, url:%s, err:%s", url, err.Error()) |
| | | return false |
| | | } |
| | | |