MCPcopy Create free account
hub / github.com/ShipSecAI/studio / getClient

Method getClient

backend/src/temporal/temporal.service.ts:235–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233 }
234
235 private async getClient(): Promise<WorkflowClient> {
236 if (this.clientPromise) {
237 return this.clientPromise;
238 }
239
240 this.clientPromise = (async () => {
241 try {
242 this.logger.log(`Connecting to Temporal at ${this.address} (namespace=${this.namespace})`);
243 const connection = await Connection.connect({ address: this.address });
244 await this.ensureNamespace(connection);
245 this.connection = connection;
246 const client = new WorkflowClient({
247 connection,
248 namespace: this.namespace,
249 });
250 this.logger.log(
251 `Temporal client ready (namespace=${this.namespace}, defaultTaskQueue=${this.defaultTaskQueue})`,
252 );
253 return client;
254 } catch (error) {
255 this.clientPromise = undefined;
256 this.logger.error(
257 `Failed to connect to Temporal: ${
258 error instanceof Error ? error.message : String(error)
259 }`,
260 );
261 throw error;
262 }
263 })();
264
265 return this.clientPromise;
266 }
267
268 private async ensureNamespace(connection: Connection): Promise<void> {
269 try {

Callers 3

startWorkflowMethod · 0.95
getWorkflowHandleMethod · 0.95
getScheduleClientMethod · 0.95

Calls 3

ensureNamespaceMethod · 0.95
connectMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected