Your Discord bot's member cache is lying to you. Mine never timed out a single member.
I set largeThreshold: 50 in my Discord bot's client config. The comment next to it said it saved memory with no functional loss. That was wrong, and it took a log search to find out how wrong. What the setting really does largeThreshold is the large_threshold field in Discord's gateway IDENTIFY payload. It is the member count above which the gateway stops sending offline members when a guild…
The Discord bot's member cache was not accurately reflecting the entire online roster. The bot was only iterating over the members who were online or recently active, not the entire guild membership. The issue stemmed from a configuration setting called "largeThreshold" which only saves memory at the cost of functional loss. This largeThreshold field in Discord's gateway IDENTIFY payload determines the member count above which the gateway stops sending offline members when a guild loads.
Above this threshold, the bot only receives members who are currently online, meaning that after every restart, the member cache only held the online members plus those the bot had seen since. The author had a verification timeout sweep in place to act on members who did not complete verification in time. However, the sweep never logged any actions because the cache did not contain any inactive or offline members.
The author resolved this issue by keeping a separate table for pending verification and explicitly fetching the full member list before iterating, thus ensuring a complete list of members. The default Discord threshold of 250 would have prevented this issue, but at the author's custom threshold of 50, it was not enough. The takeaway from this experience is that before processing a guild's members, it is essential to verify whether the cache is comprehensive and whether offline members need to be factored in.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.