Updating a public counter every 5 minutes on a free plan
ARLTS has a public "impact board" at arlts.org/impact: how many people have visited, and how many were active today, this week, and this month. The numbers come from our analytics tool (PostHog). The board used to update once an hour. Now the user counts update every 5 minutes, and it costs nothing extra. How it worked A timer in the database ( pg_cron ) calls a little cloud function once an…
The ARLTS public "impact board" now updates every 5 minutes instead of hourly, with no additional cost. This was achieved by modifying a cloud function that retrieves visitor statistics from the analytics tool PostHog. The function can operate in "quick mode," requesting only the two lightest questions about all-time visitors and active users, which reduces the load. The updated board displays visitor numbers within about 11 minutes, a significant improvement from previous updates that took up to an hour.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to