Commit 0b32fa25 by 杨北旺

修改上报策略

1 parent 15b127dc
......@@ -7,7 +7,7 @@ class sendStrategy {
dataHasSend = true
dataHasChange = false
syncStorage = false
failTime = 0
time = 0
is_first_batch_write = false
DEFAULT_SETTING!: ReportOption
init(options: ReportOption) {
......@@ -28,9 +28,17 @@ class sendStrategy {
}
function loopSend() {
setTimeout(() => {
const totalDdata = storage.getTrack()
_this.time++
if (totalDdata.length === _this.DEFAULT_SETTING.send_count) {
_this.time = 0
_this.batchSend()
} else if (_this.time === _this.DEFAULT_SETTING.send_time) {
_this.time = 0
_this.batchSend()
}
loopSend()
}, 1000 * _this.DEFAULT_SETTING.send_time * Math.pow(2, _this.failTime))
}, 1000)
}
loopWrite()
loopSend()
......@@ -73,11 +81,9 @@ class sendStrategy {
this.dataHasSend = true
this.dataHasChange = true
this.batchWrite()
this.failTime = 0
}
sendFail(data: any) {
this.dataHasSend = true
this.failTime++
storage.removeUploadData(data)
}
webrequest(option: { data: any; success: any; fail: any }) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!