@@ -10,12 +10,15 @@ import { getBlockingCommands, multilineCommandToOneLine } from 'src/utils/cli-he
10
10
import ERROR_MESSAGES from 'src/constants/error-messages' ;
11
11
import { ShortCommandExecution } from 'src/modules/workbench/models/short-command-execution' ;
12
12
import { CommandExecutionStatus } from 'src/modules/cli/dto/cli.dto' ;
13
+ import { DatabaseConnectionService } from 'src/modules/database/database-connection.service' ;
14
+ import { AppTool } from 'src/models' ;
13
15
import { getUnsupportedCommands } from './utils/getUnsupportedCommands' ;
14
16
import { WorkbenchAnalyticsService } from './services/workbench-analytics/workbench-analytics.service' ;
15
17
16
18
@Injectable ( )
17
19
export class WorkbenchService {
18
20
constructor (
21
+ private readonly databaseConnectionService : DatabaseConnectionService ,
19
22
private commandsExecutor : WorkbenchCommandsExecutor ,
20
23
private commandExecutionProvider : CommandExecutionProvider ,
21
24
private analyticsService : WorkbenchAnalyticsService ,
@@ -127,6 +130,13 @@ export class WorkbenchService {
127
130
clientOptions : IFindRedisClientInstanceByOptions ,
128
131
dto : CreateCommandExecutionsDto ,
129
132
) : Promise < CommandExecution [ ] > {
133
+ // todo: handle concurrent client creation on RedisModule side
134
+ // temporary workaround. Just create client before any command execution precess
135
+ await this . databaseConnectionService . getOrCreateClient ( {
136
+ databaseId : clientOptions . instanceId ,
137
+ namespace : AppTool . Workbench ,
138
+ } ) ;
139
+
130
140
if ( dto . resultsMode === ResultsMode . GroupMode ) {
131
141
return this . commandExecutionProvider . createMany (
132
142
[ await this . createCommandsExecution ( clientOptions , dto , dto . commands ) ] ,
0 commit comments