mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 02:03:07 +08:00
fix(counts): Collect metrics about -unread, reset when found
This commit is contained in:
parent
7b3018699f
commit
d78206d4df
1 changed files with 11 additions and 0 deletions
|
@ -89,8 +89,19 @@ class ThreadCountsStore extends NylasStore
|
||||||
_onCountsChanged: =>
|
_onCountsChanged: =>
|
||||||
DatabaseStore._query(ReadCountsQuery()).then (results) =>
|
DatabaseStore._query(ReadCountsQuery()).then (results) =>
|
||||||
@_counts = {}
|
@_counts = {}
|
||||||
|
|
||||||
|
foundNegative = false
|
||||||
for {category_id, unread, total} in results
|
for {category_id, unread, total} in results
|
||||||
|
unread = -1
|
||||||
@_counts[category_id] = {unread, total}
|
@_counts[category_id] = {unread, total}
|
||||||
|
if unread < 0 or total < 0
|
||||||
|
foundNegative = true
|
||||||
|
|
||||||
|
if foundNegative
|
||||||
|
NylasEnv.reportError(new Error('Assertion Failure: Negative Count'));
|
||||||
|
@reset()
|
||||||
|
return
|
||||||
|
|
||||||
@trigger()
|
@trigger()
|
||||||
|
|
||||||
unreadCountForCategoryId: (catId) =>
|
unreadCountForCategoryId: (catId) =>
|
||||||
|
|
Loading…
Reference in a new issue