MCPcopy Index your code
hub / github.com/simstudioai/sim / readExecutionMetaState

Function readExecutionMetaState

apps/sim/lib/execution/event-buffer.ts:607–644  ·  view source on GitHub ↗
(
  executionId: string
)

Source from the content-addressed store, hash-verified

605}
606
607export async function readExecutionMetaState(
608 executionId: string
609): Promise<ExecutionMetaReadResult> {
610 const redis = getRedisClient()
611 if (!redis) {
612 if (canUseMemoryEventBuffer()) {
613 return readMemoryMeta(executionId)
614 }
615 logger.warn('getExecutionMeta: Redis client unavailable', { executionId })
616 return { status: 'unavailable', error: 'Redis client unavailable' }
617 }
618 try {
619 const key = getMetaKey(executionId)
620 const meta = await redis.hgetall(key)
621 if (!meta || Object.keys(meta).length === 0) return { status: 'missing' }
622 if (!isExecutionStreamStatus(meta.status)) return { status: 'missing' }
623 return {
624 status: 'found',
625 meta: {
626 status: meta.status,
627 userId: meta.userId,
628 workflowId: meta.workflowId,
629 updatedAt: meta.updatedAt,
630 earliestEventId:
631 meta.earliestEventId !== undefined ? Number(meta.earliestEventId) : undefined,
632 replayStartEventId:
633 meta.replayStartEventId !== undefined ? Number(meta.replayStartEventId) : undefined,
634 },
635 }
636 } catch (error) {
637 const message = toError(error).message
638 logger.warn('Failed to read execution meta', {
639 executionId,
640 error: message,
641 })
642 return { status: 'unavailable', error: message }
643 }
644}
645
646export async function getExecutionMeta(executionId: string): Promise<ExecutionStreamMeta | null> {
647 const result = await readExecutionMetaState(executionId)

Callers 4

route.tsFile · 0.90
startFunction · 0.90
getExecutionMetaFunction · 0.85

Calls 7

getRedisClientFunction · 0.90
toErrorFunction · 0.90
canUseMemoryEventBufferFunction · 0.85
readMemoryMetaFunction · 0.85
isExecutionStreamStatusFunction · 0.85
getMetaKeyFunction · 0.70
warnMethod · 0.65

Tested by

no test coverage detected