MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getSystemChannelRole

Function getSystemChannelRole

server/src/addie/bolt-app.ts:176–201  ·  view source on GitHub ↗
(channelId: string)

Source from the content-addressed store, hash-verified

174const SYSTEM_CHANNEL_CACHE_TTL_MS = 5 * 60 * 1000;
175
176async function getSystemChannelRole(channelId: string): Promise<SystemChannelRole | null> {
177 if (!systemChannelMap || Date.now() > systemChannelMapExpiresAt) {
178 if (!systemChannelRefreshPromise) {
179 systemChannelRefreshPromise = (async () => {
180 const map = new Map<string, SystemChannelRole>();
181 const [prospect, escalation, billing, error, admin] = await Promise.all([
182 getProspectChannel(),
183 getEscalationChannel(),
184 getBillingChannel(),
185 getErrorChannel(),
186 getAdminChannel(),
187 ]);
188 if (prospect.channel_id) map.set(prospect.channel_id, 'prospect');
189 if (escalation.channel_id) map.set(escalation.channel_id, 'escalation');
190 if (billing.channel_id) map.set(billing.channel_id, 'billing');
191 if (error.channel_id) map.set(error.channel_id, 'error');
192 if (admin.channel_id) map.set(admin.channel_id, 'admin');
193 systemChannelMap = map;
194 systemChannelMapExpiresAt = Date.now() + SYSTEM_CHANNEL_CACHE_TTL_MS;
195 systemChannelRefreshPromise = null;
196 })();
197 }
198 await systemChannelRefreshPromise;
199 }
200 return systemChannelMap!.get(channelId) ?? null;
201}
202
203/**
204 * Shared database instance for working group lookups

Callers 1

buildChannelContextFunction · 0.85

Calls 8

getProspectChannelFunction · 0.85
getEscalationChannelFunction · 0.85
getBillingChannelFunction · 0.85
getErrorChannelFunction · 0.85
getAdminChannelFunction · 0.85
nowMethod · 0.80
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected