File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/app/service/service_worker Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import { stackAsyncTask } from "@App/pkg/utils/async_queue";
1515import { encodeMessage } from "@App/pkg/utils/message_value" ;
1616import { isEarlyStartScript } from "../content/utils" ;
1717
18+ let lastUpdateTime = 0 ;
19+
1820type ValueUpdateTaskInfo = {
1921 uuid : string ;
2022 id : string ;
@@ -156,7 +158,12 @@ export class ValueService {
156158 const entries = [ ] as [ string , any , any ] [ ] ;
157159 const { uuid, values, removeNotProvided } = task ;
158160 let oldValueRecord : { [ key : string ] : any } = { } ;
159- const now = Date . now ( ) ;
161+ let now = Date . now ( ) ;
162+ // 保证严格递增
163+ if ( lastUpdateTime >= now ) {
164+ now = lastUpdateTime + 0.0009765625 ; // 2^-10
165+ }
166+ lastUpdateTime = now ;
160167 let newData ;
161168 if ( ! valueModel ) {
162169 const dataModel : { [ key : string ] : any } = { } ;
You can’t perform that action at this time.
0 commit comments