Chat messages appearing in wrong order

On latest Discourse version, but this bug has been known for me for a few weeks now.

Chat messages sometimes (not frequently, but maybe 20% of the time) may appear in the wrong order, meaning sending a new message may appear above previous messages.

Anyone experienced this? I’m not sure how to repro.

Everything is fine on my side. Do you use threads? I’m not.

We do, though it seems to happen even in DM chat and not within threads. You think it’s linked to Threads being enabled?

Honestly — I don’t think anything, just throwing one wild guess.

But because no another forum is experiencing that (otherwise here would be several topics) and I have feeling that threads aren’t that popular than is thinked and changed order sounds very much failed threading, that guess was easy to made.

Or time stamps breaks.

But soon here will come someone who has better skills.

We use chat daily internally but haven’t seem to have reports of this.

How many folks is this affecting for your forum? Could you share additional information about your setup(s)? e.g. mobile or desktop, network speed, browser, number of chat channels open, etc. Does it usually happen after x minutes? We’ll need more information here otherwise we can’t solve this as well.

1 Like

Thanks.

  • Mobile phones and tablets - particularly we’ve only seen reports from users with iPhones and iPads
  • Network speed - not too sure. What are we looking for specifically?
  • Safari as a browser
  • Number of chat channels open - are we talking how many they have (including DM)? because in my understanding you can only have one “open” at a time?
  • As for if it happens after X minutes - we’ll check and update here.

It does look okay after I send something else or I exit out and back in to chat and or refresh.

Feedback from a user in our forum

Is there a way to clear chat messages or do some cleaning? @nat

We have a channel with over 50K users, chat history set to 7 days but I wonder if that’s just too much?

Oh interesting use-case here with 50K users. (cc @davidb) I think this might be a hint to why you’re seeing things we’re not.

If you’re comfortable with going into the console, there might be something you can do with our Chat::MessageDestroyer. But there is currently no “only keep the last 10k messages in this channel” feature if that’s what you’re thinking of.

2 Likes

Will this remove ALL messages in the chat?

I am just assuming there’s a db overload or something or there’s an IP block and this is why sometimes users don’t see other messages until they refresh?

This code might be useful to see how MessageDestroyer is used for deleting direct messages after the chat retention days:

In theory you could select any message with an id less than a certain number and pass those in to be destroyed (see destroy_in_batches method).

Yeah, what David said :point_up:t2: In general I don’t think we’ve had requests to purge chat messages in a certain way other than a retention period.

If you have a specific idea in mind and are ok to do so via console, you can let us know and we can provide you with something that is safe to run.

1 Like

Thank you! I’m just not sure if it’s directly linked to this issue or whether I’m just barking at the wrong tree.