File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ export async function onStartUp(extensionContext: vscode.ExtensionContext) {
5050 extension : versions . extension ,
5151 vscode : versions . vscode ,
5252 nonce : nonce
53- } ]
53+ } ] ,
54+ attempts : 1
5455 } ;
5556 } else {
5657 // Update
@@ -62,15 +63,18 @@ export async function onStartUp(extensionContext: vscode.ExtensionContext) {
6263 to : state . current ,
6364 nonce : nonce
6465 } ) ;
66+ state . attempts = 1 ;
6567 }
6668
6769 await saveLifeCycleState ( extensionContext , state ) ;
6870 state . apiAvailable = await sendQueue ( state . queue ) ;
6971 state . queue = [ ] ;
7072 await saveLifeCycleState ( extensionContext , state ) ;
7173
72- } else if ( state . queue . length > 0 ) {
74+ } else if ( state . queue . length > 0 && state . attempts < 2 ) {
7375 // There are one or more events in the queue that previously failed to send, send them
76+ state . attempts ++ ;
77+ await saveLifeCycleState ( extensionContext , state ) ;
7478 state . apiAvailable = await sendQueue ( state . queue ) ;
7579 state . queue = [ ] ;
7680 await saveLifeCycleState ( extensionContext , state ) ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ export interface LifeCycleState {
5252 } ;
5353 apiAvailable : boolean ;
5454 queue : LifeCycleEvent [ ] ;
55+ attempts : number ;
5556}
5657
5758/**
@@ -91,7 +92,7 @@ export function getLifeCycleStateInDirectory(directory: string) {
9192 resolve ( null ) ;
9293 } else {
9394 try {
94- resolve ( JSON . parse ( data . toString ( ) ) ) ;
95+ resolve ( Object . assign ( { attempts : 1 } , JSON . parse ( data . toString ( ) ) ) ) ;
9596 } catch ( _ ) {
9697 resolve ( null ) ;
9798 }
You can’t perform that action at this time.
0 commit comments