MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / record

Function record

packages/core/analytics/src/analytics.ts:210–226  ·  view source on GitHub ↗
(name, properties)

Source from the content-addressed store, hash-verified

208 );
209
210 const record: AnalyticsService["record"] = (name, properties) =>
211 Effect.flatMap(DateTime.now, (now) =>
212 Ref.update(buffer, (current) => {
213 const appended = [
214 ...current,
215 {
216 event: name,
217 properties: properties as Record<string, unknown>,
218 timestamp: DateTime.formatIso(now),
219 },
220 ];
221 // Bounded buffer: a dead network must not grow memory forever.
222 return appended.length > MAX_BUFFERED_EVENTS
223 ? appended.slice(appended.length - MAX_BUFFERED_EVENTS)
224 : appended;
225 }),
226 );
227
228 const flushEvery = config.flushInterval ?? Duration.seconds(30);
229 yield* Effect.forkScoped(

Callers

nothing calls this directly

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected