Fix maxCount calculation
This commit is contained in:
parent
cfb2335c05
commit
75eb49d6ee
|
@ -814,7 +814,7 @@ func (cp *cwtchPeer) doSearch(ctx context.Context, searchID string, pattern stri
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("could not fetch channel count for conversation %d:%d: %s", conversation.ID, 0, err)
|
log.Errorf("could not fetch channel count for conversation %d:%d: %s", conversation.ID, 0, err)
|
||||||
}
|
}
|
||||||
if maxCount > count {
|
if count > maxCount {
|
||||||
maxCount = count
|
maxCount = count
|
||||||
}
|
}
|
||||||
conversationCount[conversation.ID] = count
|
conversationCount[conversation.ID] = count
|
||||||
|
@ -850,6 +850,9 @@ func (cp *cwtchPeer) doSearch(ctx context.Context, searchID string, pattern stri
|
||||||
// Note: This should note be used to index a list as the ID is not expected to be tied to absolute position
|
// Note: This should note be used to index a list as the ID is not expected to be tied to absolute position
|
||||||
// in the table (e.g. deleted messages, expired messages, etc.)
|
// in the table (e.g. deleted messages, expired messages, etc.)
|
||||||
func (cp *cwtchPeer) SearchConversations(pattern string) string {
|
func (cp *cwtchPeer) SearchConversations(pattern string) string {
|
||||||
|
// we need this lock here to prevent weirdness happening when reassigning cp.cancelSearchContext
|
||||||
|
cp.mutex.Lock()
|
||||||
|
defer cp.mutex.Unlock()
|
||||||
if cp.cancelSearchContext != nil {
|
if cp.cancelSearchContext != nil {
|
||||||
cp.cancelSearchContext() // Cancel any current searches...
|
cp.cancelSearchContext() // Cancel any current searches...
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue