PR #152

4 votes · 4 up · 0 down

View on GitHub
4
Total Votes
+4
Upvotes
-0
Downvotes
+4-0

Comments(8)

henryivesjonesComment#152📈👁️📈 Makes the pageview counter actually keep track 📈👁️📈

@skridlevsky I would make a separate repo. I'll PR the action once its up and modify the code to point to it.

skridlevskyComment#152Makes the pageview counter actually keep track.

@henryivesjones, up to you - the tradeoffs are balanced. Noisy git history is on brand for OpenChaos. If you'd rather have a dedicated data repo, I can create one.

henryivesjonesComment#152Makes the pageview counter actually keep track.

@skridlevsky

This will make a quite busy git history in a repo and you probably don't want it to live with any other code.

How would you like to handle?

henryivesjonesComment#152Makes the pageview counter actually keep track.

@skridlevsky

Apparently they do send a SIGTERM signal. https://vercel.com/changelog/vercel-functions-now-support-graceful-shutdown

I designed my implementation around the limitations of a serverless environment and would prefer to keep it that way :)

This will make a quite busy git history in a repo and you probably don't want it to live with any other code.

I'll update the PR to handle the SIGTERM signal to flush. But generally I was fine with the "best-effort" counting. I felt like it worked best around the limitations of the project as it stood.

DavieyComment#152Makes the pageview counter actually keep track.

👎 Boring technical implementation, not chaotic enough

skridlevskyComment#152Makes the pageview counter actually keep track.

Update on both points:

I'm setting up a VPS for OpenChaos backend services. Your counter runs as a persistent process there, no more cold start problems. The in-memory approach works exactly as designed on a long-running server.

This also ties into #151 (MCP server), which needs the same persistent process for its caching layer. Both are invited in moving to https://github.com/skridlevsky/openchaos-backend.

Next step is still the same: PR the counter logic + GitHub Action config into that repo. I'll handle VPS setup and deployment.

skridlevskyComment#152Makes the pageview counter actually keep track.

Love the approach. Using a GitHub repo as the persistence layer is peak OpenChaos energy.

Two things before merge:

1. Backend ownership. I've created https://github.com/skridlevsky/openchaos-backend. Could you PR the GitHub Action config there and update the constants in this PR to point at it? The site shouldn't depend on an external repo for a core feature.

2. Serverless cold starts. openchaos.dev runs on Vercel (serverless). Each request can spin up a fresh instance, there's no persistent process. The in-memory PageCounter singleton and its setInterval flush get garbage collected when the instance goes cold. Under low traffic, most increments would be lost before the 60-second flush fires.

Happy to migrate to a hosting setup that keeps a long-running process (VPS, Render, etc.) if that's what it takes to make this work properly. The visitor counter deserves to actually count.

openchaos-bot[bot]Comment#152Makes the pageview counter actually keep track.

🤖 OpenChaos Bot

Summary: Implements a page view counter, storing counts as files in a separate GitHub repository and displaying the total on the OpenChaos site. It persists counts to a backend using the Github API.

Files changed: 5 (src/app/layout.tsx, src/components/WebCounter.tsx, src/lib/count/constants.ts, src/lib/count/getCount.ts, src/lib/count/pageCounter.ts)

Vibe: Bravely confronting rate limits with the tenacity of a thousand bots.


openchaos-bot

All Activity(13)

henryivesjonesComment#152📈👁️📈 Makes the pageview counter actually keep track 📈👁️📈

@skridlevsky I would make a separate repo. I'll PR the action once its up and modify the code to point to it.

skridlevskyComment#152Makes the pageview counter actually keep track.

@henryivesjones, up to you - the tradeoffs are balanced. Noisy git history is on brand for OpenChaos. If you'd rather have a dedicated data repo, I can create one.

henryivesjonesComment#152Makes the pageview counter actually keep track.

@skridlevsky

This will make a quite busy git history in a repo and you probably don't want it to live with any other code.

How would you like to handle?

henryivesjonesComment#152Makes the pageview counter actually keep track.

@skridlevsky

Apparently they do send a SIGTERM signal. https://vercel.com/changelog/vercel-functions-now-support-graceful-shutdown

I designed my implementation around the limitations of a serverless environment and would prefer to keep it that way :)

This will make a quite busy git history in a repo and you probably don't want it to live with any other code.

I'll update the PR to handle the SIGTERM signal to flush. But generally I was fine with the "best-effort" counting. I felt like it worked best around the limitations of the project as it stood.

DavieyComment#152Makes the pageview counter actually keep track.

👎 Boring technical implementation, not chaotic enough

skridlevskyComment#152Makes the pageview counter actually keep track.

Update on both points:

I'm setting up a VPS for OpenChaos backend services. Your counter runs as a persistent process there, no more cold start problems. The in-memory approach works exactly as designed on a long-running server.

This also ties into #151 (MCP server), which needs the same persistent process for its caching layer. Both are invited in moving to https://github.com/skridlevsky/openchaos-backend.

Next step is still the same: PR the counter logic + GitHub Action config into that repo. I'll handle VPS setup and deployment.

skridlevskyComment#152Makes the pageview counter actually keep track.

Love the approach. Using a GitHub repo as the persistence layer is peak OpenChaos energy.

Two things before merge:

1. Backend ownership. I've created https://github.com/skridlevsky/openchaos-backend. Could you PR the GitHub Action config there and update the constants in this PR to point at it? The site shouldn't depend on an external repo for a core feature.

2. Serverless cold starts. openchaos.dev runs on Vercel (serverless). Each request can spin up a fresh instance, there's no persistent process. The in-memory PageCounter singleton and its setInterval flush get garbage collected when the instance goes cold. Under low traffic, most increments would be lost before the 60-second flush fires.

Happy to migrate to a hosting setup that keeps a long-running process (VPS, Render, etc.) if that's what it takes to make this work properly. The visitor counter deserves to actually count.

openchaos-bot[bot]Comment#152Makes the pageview counter actually keep track.

🤖 OpenChaos Bot

Summary: Implements a page view counter, storing counts as files in a separate GitHub repository and displaying the total on the OpenChaos site. It persists counts to a backend using the Github API.

Files changed: 5 (src/app/layout.tsx, src/components/WebCounter.tsx, src/lib/count/constants.ts, src/lib/count/getCount.ts, src/lib/count/pageCounter.ts)

Vibe: Bravely confronting rate limits with the tenacity of a thousand bots.


openchaos-bot