Skip to content

Commit 1e9a8f6

Browse files
fix pr comments
1 parent 021bee9 commit 1e9a8f6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

redisinsight/api/src/modules/database/providers/database.factory.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Injectable, Logger, NotFoundException } from '@nestjs/common';
2+
import { v4 as uuidv4 } from 'uuid';
23
import { ConnectionType, HostingProvider } from 'src/modules/database/entities/database.entity';
34
import { catchRedisConnectionError, getHostingProvider } from 'src/utils';
45
import { Database } from 'src/modules/database/models/database';
@@ -35,7 +36,7 @@ export class DatabaseFactory {
3536
const client = await this.redisClientFactory.getConnectionStrategy().createStandaloneClient(
3637
{
3738
sessionMetadata,
38-
databaseId: database.id || 'new', // we assume that if no database id defined we are in creation process
39+
databaseId: database.id || uuidv4(), // we assume that if no database id defined we are in creation process
3940
context: ClientContext.Common,
4041
},
4142
database,
@@ -110,7 +111,7 @@ export class DatabaseFactory {
110111
const clusterClient = await this.redisClientFactory.getConnectionStrategy().createClusterClient(
111112
{
112113
sessionMetadata,
113-
databaseId: model.id || 'new', // we assume that if no database id defined we are in creation process
114+
databaseId: model.id || uuidv4(), // we assume that if no database id defined we are in creation process
114115
context: ClientContext.Common,
115116
},
116117
model,
@@ -157,7 +158,7 @@ export class DatabaseFactory {
157158
const sentinelClient = await this.redisClientFactory.getConnectionStrategy().createSentinelClient(
158159
{
159160
sessionMetadata,
160-
databaseId: model.id || 'new', // we assume that if no database id defined we are in creation process
161+
databaseId: model.id || uuidv4(), // we assume that if no database id defined we are in creation process
161162
context: ClientContext.Common,
162163
},
163164
model,

redisinsight/api/src/modules/redis-sentinel/redis-sentinel.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
HttpException, Injectable, Logger,
33
} from '@nestjs/common';
4+
import { v4 as uuidv4 } from 'uuid';
45
import { CreateSentinelDatabaseResponse } from 'src/modules/redis-sentinel/dto/create.sentinel.database.response';
56
import { CreateSentinelDatabasesDto } from 'src/modules/redis-sentinel/dto/create.sentinel.databases.dto';
67
import { Database } from 'src/modules/database/models/database';
@@ -121,7 +122,7 @@ export class RedisSentinelService {
121122
const database = await this.databaseFactory.createStandaloneDatabaseModel(dto);
122123
const client = await this.redisClientFactory.getConnectionStrategy().createStandaloneClient({
123124
sessionMetadata: this.constantsProvider.getSystemSessionMetadata(),
124-
databaseId: database.id || 'new',
125+
databaseId: database.id || uuidv4(),
125126
context: ClientContext.Common,
126127
}, database, { useRetry: false });
127128
result = await discoverSentinelMasterGroups(client);

0 commit comments

Comments
 (0)