MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / flushBufferWithUser

Function flushBufferWithUser

common/src/util/analytics-dispatcher.ts:37–55  ·  view source on GitHub ↗
(
    userId: string,
  )

Source from the content-addressed store, hash-verified

35 const isDevEnv = envName === 'dev'
36
37 function flushBufferWithUser(
38 userId: string,
39 ): AnalyticsDispatchPayload[] {
40 if (!buffered.length) {
41 return []
42 }
43
44 const toSend: AnalyticsDispatchPayload[] = []
45 for (const item of buffered.splice(0)) {
46 const rebuilt = toTrackableAnalyticsPayload({
47 ...item,
48 fallbackUserId: userId,
49 })
50 if (rebuilt) {
51 toSend.push(rebuilt)
52 }
53 }
54 return toSend
55 }
56
57 function process(
58 input: AnalyticsDispatchInput,

Callers 1

processFunction · 0.85

Calls 1

Tested by

no test coverage detected