Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

docs: cache expiry, overview syncing and hidden YouTube counts

spacesdrivebb7ccfd6345e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a09269d..5fc8de1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,12 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- The Worker cron and the GitHub Actions workflow could both publish the same scheduled post; posts are now claimed atomically
+- Channels with no public videos failed to load with "playlist cannot be found"; they now open with a "No public videos yet" message
+- Overview could show "Syncing analytics" forever: Reddit accounts and empty channels never finished syncing, and the page only re-checked once
+- YouTube likes and comments the owner hid showed as 0; they now show as Hidden
+- Cached YouTube, Instagram and Reddit analytics never expired; they now refresh after 6 hours
+- Collapsing the sidebar showed clipped labels; icons now stay in place while labels and group headings fade
+- The Reddit "Upvoted" column is now "Upvote rate", with an explanation of what it measures and why some rows show a dash
- README: `VITE_API_URL` example now ends in `/api`; the setup SQL now creates `tracked_posts` and turns on row level security for all four tables
- Buttons rendered as links no longer log a Base UI native-button warning
diff --git a/ROADMAP.md b/ROADMAP.md
index c8ddff3..a44f236 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -125,7 +125,7 @@ React Native app using the same Cloudflare Worker backend.
## Known Issues / Tech Debt
-- Redis cache TTL is never set - cached analytics data persists indefinitely until account deletion. Should add a TTL (e.g., 24 hours for video lists).
+- ~~Redis cache TTL is never set~~ Done: analytics caches expire after 6 hours.
- `public/` directory at repo root contains a legacy Express prototype - should be removed once it is confirmed unused.
- Root `package.json` and `node_modules/` belong to the legacy prototype - can be removed.
- `wrangler.toml` has no `vars` section for non-secret configuration - any non-sensitive config currently requires a redeploy to change.
diff --git a/docs/architecture/backend/CACHING.md b/docs/architecture/backend/CACHING.md
index 15b5c8c..a181c1f 100644
--- a/docs/architecture/backend/CACHING.md
+++ b/docs/architecture/backend/CACHING.md
@@ -34,11 +34,13 @@ export async function getVideosCache(redis, userId, accountId) {
## Cache TTL
-Currently no TTL is set on `videos:` or `ig:` keys. Cached data persists until:
-1. The account is deleted (explicit `redis.del()`)
-2. The Redis instance is flushed manually
+`videos:`, `ig:` and `reddit:` keys expire after 6 hours (`ANALYTICS_TTL_SECONDS` in `lib/cache.js`), so counts refetch rather than going stale. They are also removed when the account is deleted.
-**Known issue:** This means analytics data can become stale. A future improvement is to set a TTL (e.g., 24 hours) on both key types. See `ROADMAP.md`.
+`videos:` entries carry a `version` field like `ig:` entries (`VIDEOS_CACHE_VERSION`). Version 2 stores `likeCount` and `commentCount` as `null` when YouTube hides them (the owner hid likes, or comments are off), instead of `0`; the UI shows those as "Hidden".
+
+## Overview warming
+
+`GET /api/overview` returns `{ cacheWarmed, syncing }` per account. When an account has no cache entry it starts a background fetch with `waitUntil` (YouTube, Instagram and Reddit) and returns `syncing: true` only if that fetch actually started. Without Redis, an API key, a token or a cookie it returns `syncing: false`, so the client never waits on something that cannot load. The client re-polls at 4, 8 and 16 seconds while any account is syncing, then stops.
## Cache Usage in Routes