Skip to content

Commit e9edbba

Browse files
author
Artem
committed
fix comments review
1 parent 588d654 commit e9edbba

File tree

1 file changed

+50
-67
lines changed

1 file changed

+50
-67
lines changed

redisinsight/api/src/modules/cloud/job/jobs/import-free-database.cloud-job.ts

Lines changed: 50 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -38,73 +38,56 @@ export class ImportFreeDatabaseCloudJob extends CloudJob {
3838
}
3939

4040
async iteration(): Promise<Database> {
41-
try {
42-
this.logger.log('Importing free database');
43-
44-
this.checkSignal();
45-
46-
this.changeState({ step: CloudJobStep.Import });
47-
48-
this.logger.debug('Getting database metadata');
49-
50-
const cloudDatabase: CloudDatabase = await this.runChildJob(
51-
WaitForActiveDatabaseCloudJob,
52-
{
53-
databaseId: this.data.databaseId,
54-
subscriptionId: this.data.subscriptionId,
55-
subscriptionType: CloudSubscriptionType.Fixed,
56-
},
57-
this.options,
58-
);
59-
60-
if (!cloudDatabase) {
61-
// todo: throw
62-
}
63-
64-
this.checkSignal();
65-
66-
const {
67-
publicEndpoint,
68-
name,
69-
password,
70-
} = cloudDatabase;
71-
72-
const [host, port] = publicEndpoint.split(':');
73-
74-
const database = await this.dependencies.databaseService.create({
75-
host,
76-
port: parseInt(port, 10),
77-
name,
78-
nameFromProvider: name,
79-
password,
80-
provider: HostingProvider.RE_CLOUD,
81-
cloudDetails: {
82-
...cloudDatabase?.cloudDetails,
83-
free: true,
84-
},
85-
timeout: cloudConfig.cloudDatabaseConnectionTimeout,
86-
});
87-
88-
this.result = { resourceId: database.id };
89-
90-
this.changeState({ status: CloudJobStatus.Finished });
91-
92-
// this.dependencies.cloudDatabaseAnalytics.sendCloudFreeDatabaseCreated({
93-
// region: freeSubscription?.region || '',
94-
// provider: freeSubscription?.provider || '',
95-
// });
96-
97-
return database;
98-
} catch (e) {
99-
// this.dependencies.cloudDatabaseAnalytics.sendCloudFreeDatabaseFailed(
100-
// e,
101-
// {
102-
// region: freeSubscription?.region,
103-
// provider: freeSubscription?.provider,
104-
// },
105-
// );
106-
107-
throw e;
41+
this.logger.log('Importing free database');
42+
43+
this.checkSignal();
44+
45+
this.changeState({ step: CloudJobStep.Import });
46+
47+
this.logger.debug('Getting database metadata');
48+
49+
const cloudDatabase: CloudDatabase = await this.runChildJob(
50+
WaitForActiveDatabaseCloudJob,
51+
{
52+
databaseId: this.data.databaseId,
53+
subscriptionId: this.data.subscriptionId,
54+
subscriptionType: CloudSubscriptionType.Fixed,
55+
},
56+
this.options,
57+
);
58+
59+
if (!cloudDatabase) {
60+
// todo: throw
10861
}
62+
63+
this.checkSignal();
64+
65+
const {
66+
publicEndpoint,
67+
name,
68+
password,
69+
} = cloudDatabase;
70+
71+
const [host, port] = publicEndpoint.split(':');
72+
73+
const database = await this.dependencies.databaseService.create({
74+
host,
75+
port: parseInt(port, 10),
76+
name,
77+
nameFromProvider: name,
78+
password,
79+
provider: HostingProvider.RE_CLOUD,
80+
cloudDetails: {
81+
...cloudDatabase?.cloudDetails,
82+
free: true,
83+
},
84+
timeout: cloudConfig.cloudDatabaseConnectionTimeout,
85+
});
86+
87+
this.result = { resourceId: database.id };
88+
89+
this.changeState({ status: CloudJobStatus.Finished });
90+
91+
return database;
10992
}
11093
}

0 commit comments

Comments
 (0)