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

Function setExecutionMeta

apps/sim/lib/execution/event-buffer.ts:543–587  ·  view source on GitHub ↗
(
  executionId: string,
  meta: Partial<ExecutionStreamMeta>
)

Source from the content-addressed store, hash-verified

541}
542
543export async function setExecutionMeta(
544 executionId: string,
545 meta: Partial<ExecutionStreamMeta>
546): Promise<boolean> {
547 const redis = getRedisClient()
548 if (!redis) {
549 if (canUseMemoryEventBuffer()) {
550 const stream = getMemoryStream(executionId)
551 const status = meta.status ?? stream.meta?.status
552 if (!status) return false
553 stream.meta = {
554 ...stream.meta,
555 ...meta,
556 status,
557 updatedAt: new Date().toISOString(),
558 }
559 touchMemoryStream(stream)
560 return true
561 }
562 logger.warn('setExecutionMeta: Redis client unavailable', { executionId })
563 return false
564 }
565 try {
566 const key = getMetaKey(executionId)
567 const payload: Record<string, string> = {
568 updatedAt: new Date().toISOString(),
569 }
570 if (meta.status) payload.status = meta.status
571 if (meta.userId) payload.userId = meta.userId
572 if (meta.workflowId) payload.workflowId = meta.workflowId
573 if (meta.earliestEventId !== undefined) payload.earliestEventId = String(meta.earliestEventId)
574 if (meta.replayStartEventId !== undefined) {
575 payload.replayStartEventId = String(meta.replayStartEventId)
576 }
577 await redis.hset(key, payload)
578 await redis.expire(key, TTL_SECONDS)
579 return true
580 } catch (error) {
581 logger.warn('Failed to update execution meta', {
582 executionId,
583 error: toError(error).message,
584 })
585 return false
586 }
587}
588
589export async function initializeExecutionStreamMeta(
590 executionId: string,

Callers 1

Calls 7

getRedisClientFunction · 0.90
toErrorFunction · 0.90
canUseMemoryEventBufferFunction · 0.85
touchMemoryStreamFunction · 0.85
getMemoryStreamFunction · 0.70
getMetaKeyFunction · 0.70
warnMethod · 0.65

Tested by

no test coverage detected