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

Function getPendingChatStreamId

apps/sim/lib/copilot/request/session/abort.ts:109–129  ·  view source on GitHub ↗
(chatId: string)

Source from the content-addressed store, hash-verified

107}
108
109export async function getPendingChatStreamId(chatId: string): Promise<string | null> {
110 const localEntry = pendingChatStreams.get(chatId)
111 if (localEntry?.streamId) {
112 return localEntry.streamId
113 }
114
115 const redis = getRedisClient()
116 if (!redis) {
117 return null
118 }
119
120 try {
121 return (await redis.get(getChatStreamLockKey(chatId))) || null
122 } catch (error) {
123 logger.warn('Failed to load chat stream lock owner', {
124 chatId,
125 error: toError(error).message,
126 })
127 return null
128 }
129}
130
131/**
132 * Loads canonical stream lock owners for chat IDs.

Callers 1

handleUnifiedChatPostFunction · 0.90

Calls 5

getRedisClientFunction · 0.90
toErrorFunction · 0.90
getChatStreamLockKeyFunction · 0.85
getMethod · 0.65
warnMethod · 0.65

Tested by

no test coverage detected