Skip to content

perf: replace event log shift with ring buffer#119

Closed
felixvippp-ai wants to merge 4 commits into
Agentpay-Org:mainfrom
felixvippp-ai:codex/event-log-ring-buffer
Closed

perf: replace event log shift with ring buffer#119
felixvippp-ai wants to merge 4 commits into
Agentpay-Org:mainfrom
felixvippp-ai:codex/event-log-ring-buffer

Conversation

@felixvippp-ai

Copy link
Copy Markdown

Closes #104

Summary

  • Replaced event log push/shift eviction with a fixed-capacity RingEventLog that inserts and evicts in O(1).
  • Preserved chronological read semantics for /api/v1/events, including since, type, and limit.
  • Preserved /api/v1/events/summary counts and capped total semantics.
  • Added focused ring-buffer tests for below-capacity, exact-capacity, wraparound, summary after wrap, and query/filter/limit behavior after wrap.
  • Documented that the ring capacity follows EVENT_LOG_CAP; eventLogCap is currently exposed by config readback but is not PATCH-mutable.

Validation

  • Remove-Item -Recurse -Force dist; npm.cmd run build
  • $env:NODE_ENV='test'; node --test dist/eventlog-ring.test.js
  • $env:NODE_ENV='test'; node --test dist/*.test.js dist/**/*.test.js
  • npm.cmd run lint
  • npx.cmd prettier --check src/events.ts src/routes/events.ts src/events.test.ts src/eventlog-ring.test.ts src/routes/operational.test.ts
  • trailing-whitespace scan on changed files

@mikewheeleer

Copy link
Copy Markdown
Contributor

thanks for the effort here @felixvippp-ai! 🙏 issue #104 isn't assigned to you, and we merge from the assigned contributor to keep the campaign fair. please claim an open unassigned issue first, then open your PR. closing this one for now — hope to see it back 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace O(n) event-log eviction with a ring buffer to keep recordEvent O(1)

2 participants