> For the complete documentation index, see [llms.txt](https://docs.membercounter.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.membercounter.app/using-the-dashboard/how-counters-update.md).

# How counters update

How often the bot refreshes channels, and why a value can lag behind.

Counters are not live. Every few minutes the bot works out what each template should say, then renames the channel or rewrites the channel topic if the result changed.

If a value is not just late but wrong or missing, go to [Troubleshooting](/using-the-dashboard/troubleshooting.md).

## How often a channel is refreshed

| Bot                                              | Refresh interval                               |
| ------------------------------------------------ | ---------------------------------------------- |
| Public bot ("Member Counter")                    | Every 10 minutes                               |
| Legacy premium bot ("Member Counter Premium")    | Every 5 minutes                                |
| [Custom bot](/custom-bot/custom-bot.md)          | Every 5 minutes                                |
| [Self-hosted bot](/self-hosting/self-hosting.md) | Every 5 minutes with the default `.env` values |

Each run works through the servers in turn, so your channel is reached partway into it and the gap can be longer.

{% hint style="info" %}
The bot does not refresh channels when it starts up. After a restart, the first refresh happens at the next tick of the schedule.
{% endhint %}

## Unchanged values are skipped

The bot writes to Discord only when the new result differs from what the channel already says. **Last updated:** on the channel page still moves, because the bot did process the template.

## Member counts on the public and legacy premium bots

Neither the public bot nor the legacy premium bot can read the member list. Each asks Discord for approximate member and presence counts instead, every 20 minutes. So the count can be up to 20 minutes old when the channel is refreshed, and a new member can take up to half an hour to show up. A custom bot and a self-hosted bot read the real member list, so their counts are current at the moment the channel is refreshed.

See [Members](/counters-reference/members.md) for which filters each bot supports.

## Which bot updates your server

A server can hold more than one Member Counter bot, for example the public bot and your own [custom bot](/custom-bot/custom-bot.md). Only one of them updates the counters, and the custom bot has priority.

* Add a custom bot and it takes over the counters within a few minutes.
* Remove it, or let it stop, and the public bot picks the server back up. That takes about 30 minutes.

Your settings are kept either way. What changes is the refresh interval, and whether counters that need privileged intents work.

## Counters that cache their own data

Counters that call an outside service reuse the answer for a while instead of calling it on every refresh.

| Counter                                       | How long a value is reused                                                                    |
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [Twitch](/counters-reference/twitch.md)       | 15 minutes                                                                                    |
| [Reddit](/counters-reference/reddit.md)       | 15 minutes                                                                                    |
| [Memerator](/counters-reference/memerator.md) | 30 minutes                                                                                    |
| [YouTube](/counters-reference/youtube.md)     | 60 minutes                                                                                    |
| [HTTP](/counters-reference/http.md)           | The **Lifetime (in seconds)** you set. Leave it empty and the URL is fetched on every refresh |

Every other counter is computed on each refresh.

{% hint style="warning" %}
The [Game](/counters-reference/game.md) counter is not cached. The bot queries the game server on every refresh, for every counter channel that watches it.
{% endhint %}

## Clock and Date round to 5 minutes

[Clock](/counters-reference/clock.md) and [Date](/counters-reference/date.md) round the current time to the nearest 5 minutes, not down. A clock never shows real seconds, and it changes at most once every 5 minutes. Rounding to the nearest value also means it can read up to 2 minutes 30 seconds ahead of the real time. On the public bot it usually moves in 10-minute steps, because the bot never writes the 5-minute values in between.

## Discord's own rate limit

Discord limits how often a channel can be renamed, per channel. A counter whose value changes on nearly every refresh, such as a fast [Countdown](/counters-reference/countdown.md), gets throttled. The bot queues the edit and it goes through as soon as Discord accepts it, so the value arrives late rather than not at all.

Moving the counter to a channel topic does not get around this. The bot writes the name and the topic with the same Discord call.

## Checking when a channel was last processed

Open the channel in the dashboard. **Last updated** is the time the bot last processed that channel.

<figure><img src="https://1582170640-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lu2S5r7lKtu4IK5ucu9%2Fuploads%2Fgit-blob-89d08de1bc5da83d2b8b3c0385c73217535ddc46%2Fdashboard-channel-last-updated.png?alt=media" alt="Channel page with the Last updated time"><figcaption><p>The channel page tells you when the bot last processed this template.</p></figcaption></figure>

* Minutes old, but the channel still shows an old value: the value did not change, so the bot skipped the write.
* Hours old: the bot is not processing the channel at all. See [Troubleshooting](/using-the-dashboard/troubleshooting.md).
* **Last updated: Unknown date**: the bot has never processed this channel. That is what a new counter shows until the first refresh reaches it.

<details>

<summary>Technical details</summary>

* Channel refresh cron: `0 */5 * * * *` when the bot instance is premium, `0 */10 * * * *` when it is not. Self-hosting: `DISCORD_BOT_INSTANCE_IS_PREMIUM` ships as `true`, set it to `false` and the interval becomes 10 minutes.
* A tick is dropped while the previous run of the same job is still going. It does not queue behind it.
* Up to 20 servers are processed at the same time (`GUILD_CONCURRENCY`), and all counter channels of one server are processed together.
* A run takes a Redis FIFO queue plus a Redlock on the Discord-intensive operation key, 60 s TTL, extended every 30 s. The approximate member count job takes the same lock, so the two take turns and either can delay the other.
* The computed value is cut to 1023 characters for a topic and to 99 characters for a name, then compared against `channel.topic` for text and announcement channels and against `channel.name` for voice channels and categories. Equal means no API call at all.
* An Unknown Channel (404) during an update disables that channel's template, so the job stops retrying a deleted channel.
* Approximate member and presence counts: `0 */20 * * * *`, 10 servers at a time, also runs on startup, disabled on privileged bots.
* Evaluator priority: every bot advertises its priority for each of its servers every 5 minutes, also on ready and on a Redis reconnect, and the key expires after 900 s. The highest advertised value wins, and a bot handles a server only when the advertised priority is `<=` its own. `DISCORD_BOT_INSTANCE_COMPUTE_PRIORITY` is `0` on a self-hosted bot; custom bots are launched with `2`.
* A server with no current advertisement is skipped by every bot. Worst case for a handover back to the public bot: 15 minutes for the expiry, 5 minutes for the next advertisement, then one refresh interval.
* Cache lifetimes sit in each counter's evaluator under `packages/services/src/DataSource/DataSourceEvaluator/evaluators/`. Values are stored in Redis under a key built from the counter and its subject, not the server, so two servers counting the same subreddit share one value, and a Redis failure counts as a cache miss.
* Clock and Date round with `Math.round` over a 5-minute coefficient. In Clock that makes `%S` always render `00` and `%s` always render `0`; Date has no second placeholders.

</details>
