From 77023f6400ca9857e3c1b3f68fbef93c517dd4f2 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 15 Jul 2013 15:09:35 +0000 Subject: [PATCH] Fix bug with threads queue update Move user to priority queue when operator has connection problems --- src/messenger/webim/libs/classes/thread.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/messenger/webim/libs/classes/thread.php b/src/messenger/webim/libs/classes/thread.php index e7f423b5..2a452e7b 100644 --- a/src/messenger/webim/libs/classes/thread.php +++ b/src/messenger/webim/libs/classes/thread.php @@ -559,6 +559,10 @@ Class Thread { * @param boolean $is_typing Indicates if user or operator is typing a message. */ public function ping($is_user, $is_typing) { + // Indicates if revision ID of the thread should be updated on save. + // Update revision leads to rerender thread in threads list at client + // side. Do it on every ping is too costly. + $update_revision = false; // Last ping time of other side $last_ping_other_side = 0; // Update last ping time @@ -603,6 +607,10 @@ Class Thread { // And update thread $this->state = self::STATE_WAITING; $this->nextAgent = 0; + + // Significant fields of the thread (state and nextAgent) + // are changed. Update revision ID on save. + $update_revision = true; } } else { // _Other_ side is user @@ -622,7 +630,7 @@ Class Thread { } } - $this->save(false); + $this->save($update_revision); } /**