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

Function ensureTemporalNamespace

worker/src/temporal/workers/dev.worker.ts:411–441  ·  view source on GitHub ↗
(connection: NativeConnection, namespace: string)

Source from the content-addressed store, hash-verified

409});
410
411async function ensureTemporalNamespace(connection: NativeConnection, namespace: string) {
412 try {
413 await connection.workflowService.describeNamespace({ namespace });
414 console.log(`✅ Temporal namespace "${namespace}" is ready`);
415 return;
416 } catch (error) {
417 if (!(isGrpcServiceError(error) && error.code === grpcStatus.NOT_FOUND)) {
418 throw error;
419 }
420 }
421
422 console.warn(`⚠️ Temporal namespace "${namespace}" not found; attempting to create it`);
423
424 try {
425 const defaultRetentionDays = 7;
426 await connection.workflowService.registerNamespace({
427 namespace,
428 workflowExecutionRetentionPeriod: {
429 seconds: Long.fromNumber(defaultRetentionDays * 24 * 60 * 60),
430 nanos: 0,
431 },
432 });
433 console.log(`✅ Temporal namespace "${namespace}" created`);
434 } catch (error) {
435 if (isGrpcServiceError(error) && error.code === grpcStatus.ALREADY_EXISTS) {
436 console.log(`✅ Temporal namespace "${namespace}" already exists`);
437 return;
438 }
439 throw error;
440 }
441}

Callers 1

mainFunction · 0.85

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected