mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fix race condition in combination with nodePush
If a nodePush notification comes in *after* PHP fetched the new messages from database, but before the server reply is received it may delay the arrival of the new message up to a minute (where the automated timer kicks in)
This commit is contained in:
parent
bc11d9a7ef
commit
12b321d7e8
@ -68,6 +68,7 @@ exposed by a function if necessary.
|
|||||||
fish: null
|
fish: null
|
||||||
|
|
||||||
loading = false
|
loading = false
|
||||||
|
loadingAwaiting = false
|
||||||
|
|
||||||
autocomplete =
|
autocomplete =
|
||||||
offset: 0
|
offset: 0
|
||||||
@ -602,12 +603,18 @@ Fetch new messages from the server and pass them to `handleMessages`. The userli
|
|||||||
showError WCF.Language.get 'chat.error.onMessageLoad'
|
showError WCF.Language.get 'chat.error.onMessageLoad'
|
||||||
complete: ->
|
complete: ->
|
||||||
loading = false
|
loading = false
|
||||||
|
|
||||||
|
if loadingAwaiting
|
||||||
|
loadingAwaiting = false
|
||||||
|
do getMessages
|
||||||
|
|
||||||
Prevent loading messages in parallel.
|
Prevent loading messages in parallel.
|
||||||
|
|
||||||
beforeSend: ->
|
beforeSend: ->
|
||||||
return false if loading
|
if loading
|
||||||
|
loadingAwaiting = true
|
||||||
|
return false
|
||||||
|
|
||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
Insert the given messages into the chat stream.
|
Insert the given messages into the chat stream.
|
||||||
|
Loading…
Reference in New Issue
Block a user