Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-tracker-javascript
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b32fa25
authored
Jan 02, 2024
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改上报策略
1 parent
15b127dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
src/modules/report.ts
src/modules/report.ts
View file @
0b32fa2
...
@@ -7,7 +7,7 @@ class sendStrategy {
...
@@ -7,7 +7,7 @@ class sendStrategy {
dataHasSend
=
true
dataHasSend
=
true
dataHasChange
=
false
dataHasChange
=
false
syncStorage
=
false
syncStorage
=
false
failT
ime
=
0
t
ime
=
0
is_first_batch_write
=
false
is_first_batch_write
=
false
DEFAULT_SETTING
!
:
ReportOption
DEFAULT_SETTING
!
:
ReportOption
init
(
options
:
ReportOption
)
{
init
(
options
:
ReportOption
)
{
...
@@ -28,9 +28,17 @@ class sendStrategy {
...
@@ -28,9 +28,17 @@ class sendStrategy {
}
}
function
loopSend
()
{
function
loopSend
()
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
totalDdata
=
storage
.
getTrack
()
_this
.
time
++
if
(
totalDdata
.
length
===
_this
.
DEFAULT_SETTING
.
send_count
)
{
_this
.
time
=
0
_this
.
batchSend
()
_this
.
batchSend
()
}
else
if
(
_this
.
time
===
_this
.
DEFAULT_SETTING
.
send_time
)
{
_this
.
time
=
0
_this
.
batchSend
()
}
loopSend
()
loopSend
()
},
1000
*
_this
.
DEFAULT_SETTING
.
send_time
*
Math
.
pow
(
2
,
_this
.
failTime
)
)
},
1000
)
}
}
loopWrite
()
loopWrite
()
loopSend
()
loopSend
()
...
@@ -73,11 +81,9 @@ class sendStrategy {
...
@@ -73,11 +81,9 @@ class sendStrategy {
this
.
dataHasSend
=
true
this
.
dataHasSend
=
true
this
.
dataHasChange
=
true
this
.
dataHasChange
=
true
this
.
batchWrite
()
this
.
batchWrite
()
this
.
failTime
=
0
}
}
sendFail
(
data
:
any
)
{
sendFail
(
data
:
any
)
{
this
.
dataHasSend
=
true
this
.
dataHasSend
=
true
this
.
failTime
++
storage
.
removeUploadData
(
data
)
storage
.
removeUploadData
(
data
)
}
}
webrequest
(
option
:
{
data
:
any
;
success
:
any
;
fail
:
any
})
{
webrequest
(
option
:
{
data
:
any
;
success
:
any
;
fail
:
any
})
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment