Skip to content

Commit d62d2ad

Browse files
committed
Update vscode-connect.ts
1 parent f64456c commit d62d2ad

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/app/service/offscreen/vscode-connect.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ export class VSCodeConnect {
184184
private connectTimerId: ReturnType<typeof setTimeout> | null = null;
185185
private reconnectTimerId: ReturnType<typeof setTimeout> | null = null;
186186

187-
/** * epoch 用于确保非同步回调的时效性
188-
* 每次发起新连接时都会递增,旧的 epoch 回调会被忽略
187+
/**
188+
* * epoch 用于确保非同步回调的时效性
189+
* * 每次发起新连接时都会递增,旧的 epoch 回调会被忽略
189190
*/
190191
private epoch = 0;
191192
private lastParams: VSCodeConnectParam | null = null;
@@ -212,7 +213,7 @@ export class VSCodeConnect {
212213
* 建立或替换 WebSocket 连接
213214
*/
214215
private async connect(params: VSCodeConnectParam): Promise<void> {
215-
const currentEpoch = ++this.epoch;
216+
const currentEpoch = (this.epoch = (this.epoch & 255) + 1);
216217
this.lastParams = { ...params };
217218

218219
this.cleanup();

0 commit comments

Comments
 (0)