From 38e7a9525f22919c654dbc36c56acbe839fe4469 Mon Sep 17 00:00:00 2001 From: "Carlos Alexandre S. da Fonseca" Date: Tue, 21 Nov 2017 10:29:09 -0200 Subject: [PATCH] MDL-24678 mod_chat: Fixed race condition on chat module --- mod/chat/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/chat/lib.php b/mod/chat/lib.php index ef91dc1bf6d..f16e8a9743f 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -566,7 +566,7 @@ function chat_get_latest_message($chatid, $groupid=0) { $sql = "SELECT * FROM {chat_messages_current} WHERE chatid = :chatid $groupselect - ORDER BY timestamp DESC"; + ORDER BY timestamp DESC, id DESC"; // Return the lastest one message. return $DB->get_record_sql($sql, $params, true);