mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Ensure that onTimeoutHandler is called when there are unacknowledged edits (#18340)
GitOrigin-RevId: aa6430d7e32f6e27b67f92b187dbb13349fc6a40
This commit is contained in:
parent
95ab3921d7
commit
81559967f2
1 changed files with 4 additions and 2 deletions
|
@ -126,7 +126,9 @@ class Reporter {
|
||||||
// Another handler processed the 'meta' entry already
|
// Another handler processed the 'meta' entry already
|
||||||
if (!this.queue.length) return
|
if (!this.queue.length) return
|
||||||
|
|
||||||
const maybeLocalMeta = this.getMetaPreferLocal()
|
// There is always an item on the queue at this point,
|
||||||
|
// so getMetaPreferLocal will always return a Meta object
|
||||||
|
const maybeLocalMeta = this.getMetaPreferLocal() as Meta
|
||||||
|
|
||||||
// Discard other, newly arrived 'meta's
|
// Discard other, newly arrived 'meta's
|
||||||
this.queue.length = 0
|
this.queue.length = 0
|
||||||
|
@ -135,7 +137,7 @@ class Reporter {
|
||||||
// Do not flood the server with losing-edits events
|
// Do not flood the server with losing-edits events
|
||||||
const reportedRecently =
|
const reportedRecently =
|
||||||
this.lastReport !== null && now - this.lastReport < REPORT_EVERY
|
this.lastReport !== null && now - this.lastReport < REPORT_EVERY
|
||||||
if (!reportedRecently && maybeLocalMeta) {
|
if (!reportedRecently) {
|
||||||
this.lastReport = now
|
this.lastReport = now
|
||||||
this.onTimeoutHandler(maybeLocalMeta)
|
this.onTimeoutHandler(maybeLocalMeta)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue