Skip to content

Async org-indexing worker + per-member monthly resolution#102

Draft
peetzweg wants to merge 1 commit into
mainfrom
feature-async-org-indexing
Draft

Async org-indexing worker + per-member monthly resolution#102
peetzweg wants to merge 1 commit into
mainfrom
feature-async-org-indexing

Conversation

@peetzweg

@peetzweg peetzweg commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Part of #84. Adds a background worker that indexes orgs ("companies") at monthly resolution — the data behind a company commit chart — instead of the request path's lifetime-totals-only build.

Why: the request path deliberately stores lifetime totals only (~2 requests/member); monthly resolution costs ~12× that, too heavy for a live build. And mega-orgs (e.g. google, 635 members) can't be built on-demand at all.

How: a new scripts/refresh-orgs.ts worker enumerates each org's members and fetches monthly org-scoped windows, paced under GitHub's 5k/hr limit with a 500-request floor reserved for live traffic (same politeness model as backfill-contributions.ts). New org_member_monthly table holds per-member months; rolled up into the org's monthly_commits rows for the chart. The request path now records oversized orgs (builtAt null) so the worker can pick them up.

Draft — landing the lightweight "record looked-up orgs" slice separately first; this merges once we've run the worker end-to-end.

The request path builds orgs at lifetime-totals resolution only. This adds
a background worker (scripts/refresh-orgs.ts) that upgrades orgs to monthly
resolution — the data behind a new company commit chart — paced well under
GitHub's rate limit with a reserved floor for live traffic.

- org_member_monthly table (one row per org/member/month) + migration
- fetchOrgMemberWindows returns per-window totals; fetchOrgMemberContributions
  now sums them for the request path
- getOrgSummary assembles a cumulative chart series from monthly_commits rows
- OrgView renders the company chart once the worker has written monthly rows
- oversized orgs are recorded (builtAt null) so the worker can pick them up
@git-hub-peetzweg

git-hub-peetzweg Bot commented Jul 8, 2026

Copy link
Copy Markdown

The preview deployment for peetzweg/commit-history:coolify-bwc8csg4w8gkkgcg8s404cks is ready. 🟢

Open Preview | Open Build Logs | Open Application Logs

Last updated at: 2026-07-08 19:32:47 CET

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.

1 participant