Skip to content

Commit a7c8806

Browse files
avoid dupl queued monitor services
1 parent c892ce3 commit a7c8806

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arduino-ide-extension/src/node/monitor-manager.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class MonitorManager extends CoreClientAware {
3434
};
3535

3636
private startMonitor_PendingRequests: {
37+
monitorID: string;
3738
requestFor: [Board, Port];
3839
postStartCallback: (status: Status) => void;
3940
}[] = [];
@@ -107,10 +108,17 @@ export class MonitorManager extends CoreClientAware {
107108
}
108109

109110
if (this.uploadIsInProgress()) {
111+
this.startMonitor_PendingRequests =
112+
this.startMonitor_PendingRequests.filter(
113+
(request) => request.monitorID !== monitorID
114+
);
115+
110116
this.startMonitor_PendingRequests.push({
117+
monitorID,
111118
requestFor: [board, port],
112119
postStartCallback,
113120
});
121+
114122
return;
115123
}
116124

@@ -229,7 +237,8 @@ export class MonitorManager extends CoreClientAware {
229237
this.startMonitor_PendingRequests = [];
230238

231239
for (const {
232-
requestFor: [board, port],
240+
monitorID,
241+
requestFor: [_, port],
233242
postStartCallback: onFinish,
234243
} of queued) {
235244
const boardsState = await this.boardsService.getState();
@@ -241,7 +250,6 @@ export class MonitorManager extends CoreClientAware {
241250
.some((portAddress: string) => port.address === portAddress);
242251

243252
if (boardIsStillOnPort) {
244-
const monitorID = this.monitorID(board, port);
245253
const monitorService = this.monitorServices.get(monitorID);
246254

247255
if (monitorService) {

0 commit comments

Comments
 (0)