Skip to content

Commit 3f07f39

Browse files
author
KIvanow
committed
removed setImmediate to check
1 parent 5c49cbd commit 3f07f39

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

redisinsight/api/src/modules/database-discovery/local.database-discovery.service.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,27 @@ export class LocalDatabaseDiscoveryService extends DatabaseDiscoveryService {
4242

4343
// Mark as running and perform discovery in background
4444
this.isDiscoveryRunning = true;
45-
setImmediate(async () => {
46-
try {
47-
// check agreements to understand if it is first launch
48-
const settings =
49-
await this.settingsService.getAppSettings(sessionMetadata);
45+
try {
46+
// check agreements to understand if it is first launch
47+
const settings =
48+
await this.settingsService.getAppSettings(sessionMetadata);
5049

51-
if (!settings?.agreements?.eula) {
52-
this.isDiscoveryRunning = false;
53-
return;
54-
}
50+
if (!settings?.agreements?.eula) {
51+
this.isDiscoveryRunning = false;
52+
return;
53+
}
5554

56-
const { discovered } =
57-
await this.preSetupDatabaseDiscoveryService.discover(sessionMetadata);
55+
const { discovered } =
56+
await this.preSetupDatabaseDiscoveryService.discover(sessionMetadata);
5857

59-
if (!discovered && firstRun) {
60-
await this.autoDatabaseDiscoveryService.discover(sessionMetadata);
61-
}
62-
} catch (e) {
63-
// ignore error
64-
this.logger.error('Unable to discover databases', e);
65-
} finally {
66-
this.isDiscoveryRunning = false;
58+
if (!discovered && firstRun) {
59+
await this.autoDatabaseDiscoveryService.discover(sessionMetadata);
6760
}
68-
});
61+
} catch (e) {
62+
// ignore error
63+
this.logger.error('Unable to discover databases', e);
64+
} finally {
65+
this.isDiscoveryRunning = false;
66+
}
6967
}
7068
}

0 commit comments

Comments
 (0)