Chat sometimes not updating realtime

AI-generated summary

codergautam reports that Discourse chat occasionally fails to update in real time, especially during active group chats, requiring a refresh to sync messages. Though difficult to reproduce, the issue affects many users on their 4GB AMD droplet, while other features work fine. Falco suggests checking browser DevTools for 429 errors and requests screenshots, which codergautam provides. Falco then advises reviewing Cloudflare configuration: confirming the Cloudflare template is in app.yml (which codergautam confirms), warning against proxying MessageBus via Cloudflare (which may cause latency), and checking server load. codergautam notes low CPU and disk usage but plans to increase UNICORN_WORKERS. They also express willingness to remove Cloudflare if it significantly helps, though they’re unfamiliar with MessageBus and its implications.

Sometimes the Discourse chat doesn’t update in realtime. I’ve had lots of issue reproducing this so I understand if it’s hard to fix. But sometimes what happens is (especially when there is 5-10 people chatting at once) the chat gets out of sync, you can still type and send normal, but everything is frozen and you don’t see the messages sent my other people unless you re-open which seems to kind of refresh it.

Almost all the active users in my Forum face this issue, and I’m wondering is there any way I can reduce this, but again as it’s very random I understand if it’s hard to fix. I’m using a 4GB ram Discourse AMD droplet and this is the only issue, everything else (including topic async updates) are completely fine.

When that happens check your browser DevTools. It will probably show a few requests failing with 429 errors. Reply here if you can confirm this is the case.

Please post the screenshots here.

Sorry, does this help?

Your site is behind Cloudflare so you need to check:

  • Have you added the Cloudflare template to the app.yml file? Is Discourse getting the correct user IPs?

  • You are serving MessageBus via the Cloudflare proxy, that was a bad idea last we checked, see Full site CDN acceleration for Discourse - #26 by Hyan

  • Is your server struggling for resources, so it’s sending 429 because of the load? You can try removing extra plugins to see if this solves the issue. Otherwise you may try increasing the number of UNICORN_WORKERS a bit.

Yes, we have added it and getting correct IPs in the Admin Dashboard.

I can remove cloudflare if it will make a significant difference but I’m struggling to understand what is MessageBus and what are the issues it causes. Will study that topic more.

CPU is always under 20%, disk barely touches 60%. I will try increasing unicorns.