Skip to content

Commit b166d1a

Browse files
committed
dbeaver/pro#10246 separate connected keys
1 parent d7f82fb commit b166d1a

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

webapp/packages/core-connections/src/ConnectionInfoResource.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,33 @@ export class ConnectionInfoResource extends CachedMapResource<IConnectionInfoPar
224224
connectionInfoEventHandler.onEvent<ResourceKeyList<IConnectionInfoParams>>(
225225
ServerEventId.CbDatasourceUpdated,
226226
key => {
227-
if (this.isConnected(key) && !this.isOutdated(key)) {
228-
const connection = this.get(key);
227+
const connectedKey = resourceKeyList<IConnectionInfoParams>([]);
228+
const disconnectedKey = resourceKeyList<IConnectionInfoParams>([]);
229+
230+
for (const connectionKey of key) {
231+
if (this.isConnected(connectionKey)) {
232+
connectedKey.push(connectionKey);
233+
} else {
234+
disconnectedKey.push(connectionKey);
235+
}
236+
}
229237

230-
this.dataSynchronizationService
231-
.requestSynchronization('connection', connection.map(connection => connection?.name).join('\n'))
232-
.then(state => {
233-
if (state) {
234-
this.updateFromEvent(key);
235-
}
236-
});
237-
} else {
238-
this.updateFromEvent(key);
238+
if (disconnectedKey.length > 0) {
239+
this.updateFromEvent(disconnectedKey);
239240
}
241+
242+
if (connectedKey.length === 0) {
243+
return;
244+
}
245+
246+
const connection = this.get(connectedKey);
247+
this.dataSynchronizationService
248+
.requestSynchronization('connection', connection.map(connection => connection?.name).join('\n'))
249+
.then(state => {
250+
if (state) {
251+
this.updateFromEvent(connectedKey);
252+
}
253+
});
240254
},
241255
data =>
242256
resourceKeyList(

0 commit comments

Comments
 (0)