File tree 1 file changed +39
-1
lines changed
packages/app-backend-core/src 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,40 @@ export async function performanceMarkStart (
35
35
groupId,
36
36
} ,
37
37
} , app , ctx )
38
+
39
+ if ( markEndQueue . has ( groupKey ) ) {
40
+ const {
41
+ app,
42
+ uid,
43
+ instance,
44
+ type,
45
+ time,
46
+ } = markEndQueue . get ( groupKey )
47
+ markEndQueue . delete ( groupKey )
48
+ await performanceMarkEnd (
49
+ app ,
50
+ uid ,
51
+ instance ,
52
+ type ,
53
+ time ,
54
+ ctx ,
55
+ )
56
+ }
38
57
} catch ( e ) {
39
58
if ( SharedData . debugInfo ) {
40
59
console . error ( e )
41
60
}
42
61
}
43
62
}
44
63
64
+ const markEndQueue = new Map < string , {
65
+ app : App ,
66
+ uid : number ,
67
+ instance : ComponentInstance ,
68
+ type : string ,
69
+ time : number ,
70
+ } > ( )
71
+
45
72
export async function performanceMarkEnd (
46
73
app : App ,
47
74
uid : number ,
@@ -55,7 +82,18 @@ export async function performanceMarkEnd (
55
82
const appRecord = await getAppRecord ( app , ctx )
56
83
const componentName = await appRecord . backend . api . getComponentName ( instance )
57
84
const groupKey = `${ uid } -${ type } `
58
- const { groupId, time : startTime } = appRecord . perfGroupIds . get ( groupKey )
85
+ const groupInfo = appRecord . perfGroupIds . get ( groupKey )
86
+ if ( ! groupInfo ) {
87
+ markEndQueue . set ( groupKey , {
88
+ app,
89
+ uid,
90
+ instance,
91
+ type,
92
+ time,
93
+ } )
94
+ return
95
+ }
96
+ const { groupId, time : startTime } = groupInfo
59
97
const duration = time - startTime
60
98
await addTimelineEvent ( {
61
99
layerId : 'performance' ,
You can’t perform that action at this time.
0 commit comments