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

Function scheduleBufferCleanup

apps/sim/lib/copilot/request/session/buffer.ts:107–126  ·  view source on GitHub ↗
(
  streamId: string,
  ttlSeconds = DEFAULT_COMPLETED_TTL_SECONDS
)

Source from the content-addressed store, hash-verified

105}
106
107export async function scheduleBufferCleanup(
108 streamId: string,
109 ttlSeconds = DEFAULT_COMPLETED_TTL_SECONDS
110): Promise<void> {
111 try {
112 await withRedisRetry({ operation: 'schedule_outbox_cleanup', streamId }, async (redis) => {
113 const pipeline = redis.pipeline()
114 pipeline.expire(getEventsKey(streamId), ttlSeconds)
115 pipeline.expire(getSeqKey(streamId), ttlSeconds)
116 pipeline.expire(getAbortKey(streamId), ttlSeconds)
117 await pipeline.exec()
118 })
119 } catch (error) {
120 logger.warn('Failed to shorten stream buffer TTL during cleanup', {
121 streamId,
122 ttlSeconds,
123 error: toError(error).message,
124 })
125 }
126}
127
128export async function appendEvents(
129 envelopes: PersistedStreamEventEnvelope[]

Callers 2

startFunction · 0.90
buffer.test.tsFile · 0.90

Calls 6

toErrorFunction · 0.90
getAbortKeyFunction · 0.85
withRedisRetryFunction · 0.70
getEventsKeyFunction · 0.70
getSeqKeyFunction · 0.70
warnMethod · 0.65

Tested by

no test coverage detected