debug: add more logs to determine why community requests are missing

This commit is contained in:
Richard Ramos 2022-12-12 18:24:36 -04:00 committed by RichΛrd
parent 7f109710e2
commit c7ce9adb5e
4 changed files with 24 additions and 3 deletions

View File

@ -1402,7 +1402,7 @@ func (m *Messenger) Init() error {
}
for _, org := range joinedCommunities {
// the org advertise on the public topic derived by the pk
publicChatIDs = append(publicChatIDs, org.IDString(), org.StatusUpdatesChannelID(), org.MagnetlinkMessageChannelID(), org.MemberUpdateChannelID())
publicChatIDs = append(publicChatIDs, org.DefaultFilters()...)
// This is for status-go versions that didn't have `CommunitySettings`
// We need to ensure communities that existed before community settings

View File

@ -158,6 +158,8 @@ func (f *FiltersManager) InitCommunityFilters(pks []*ecdsa.PrivateKey) ([]*Filte
f.filters[filterID] = filter
f.logger.Debug("registering filter for", zap.String("chatID", filterID), zap.String("type", "community"), zap.String("topic", rawFilter.Topic.String()))
filters = append(filters, filter)
}
return filters, nil
@ -368,6 +370,8 @@ func (f *FiltersManager) LoadPersonal(publicKey *ecdsa.PublicKey, identity *ecds
f.filters[chatID] = chat
f.logger.Debug("registering filter for", zap.String("chatID", chatID), zap.String("type", "personal"), zap.String("topic", filter.Topic.String()))
return chat, nil
}
@ -404,6 +408,8 @@ func (f *FiltersManager) loadPartitioned(publicKey *ecdsa.PublicKey, identity *e
f.filters[chatID] = chat
f.logger.Debug("registering filter for", zap.String("chatID", chatID), zap.String("type", "partitioned"), zap.String("topic", filter.Topic.String()))
return chat, nil
}
@ -437,6 +443,8 @@ func (f *FiltersManager) LoadNegotiated(secret types.NegotiatedSecret) (*Filter,
f.filters[chat.ChatID] = chat
f.logger.Debug("registering filter for", zap.String("chatID", chatID), zap.String("type", "negotiated"), zap.String("topic", filter.Topic.String()))
return chat, nil
}
@ -482,6 +490,8 @@ func (f *FiltersManager) LoadDiscovery() ([]*Filter, error) {
f.filters[personalDiscoveryChat.ChatID] = personalDiscoveryChat
f.logger.Debug("registering filter for", zap.String("chatID", personalDiscoveryChat.ChatID), zap.String("type", "discovery"), zap.String("topic", personalDiscoveryChat.Topic.String()))
return []*Filter{personalDiscoveryChat}, nil
}
@ -516,6 +526,8 @@ func (f *FiltersManager) LoadPublic(chatID string) (*Filter, error) {
f.filters[chatID] = chat
f.logger.Debug("registering filter for", zap.String("chatID", chatID), zap.String("type", "public"), zap.String("topic", filterAndTopic.Topic.String()))
return chat, nil
}
@ -545,6 +557,9 @@ func (f *FiltersManager) LoadContactCode(pubKey *ecdsa.PublicKey) (*Filter, erro
}
f.filters[chatID] = chat
f.logger.Debug("registering filter for", zap.String("chatID", chatID), zap.String("type", "contact-code"), zap.String("topic", contactCodeFilter.Topic.String()))
return chat, nil
}

View File

@ -174,19 +174,24 @@ func (fs *Filters) NotifyWatchers(recvMessage *ReceivedMessage) bool {
var matched bool
candidates := fs.GetWatchersByTopic(*topic)
if len(candidates) == 0 {
log.Debug("no filters available for this topic", "message", recvMessage.Hash().Hex(), "topic", (*topic).String())
}
for _, watcher := range candidates {
matched = true
if decodedMsg == nil {
decodedMsg = recvMessage.Open(watcher)
if decodedMsg == nil {
log.Trace("processing message: failed to open", "message", recvMessage.Hash().Hex(), "filter", watcher.id)
log.Debug("processing message: failed to open", "message", recvMessage.Hash().Hex(), "filter", watcher.id)
}
} else {
matched = watcher.MatchMessage(decodedMsg)
}
if matched && decodedMsg != nil {
log.Trace("processing message: decrypted", "hash", recvMessage.Hash().Hex())
log.Debug("processing message: decrypted", "hash", recvMessage.Hash().Hex())
if watcher.Src == nil || IsPubKeyEqual(decodedMsg.Src, watcher.Src) {
watcher.Trigger(decodedMsg)
}

View File

@ -1189,6 +1189,7 @@ func (w *Waku) processQueue() {
// If not matched we remove it
if !matched {
w.logger.Debug("filters did not match", zap.String("hash", e.Hash().String()))
w.storeMsgIDsMu.Lock()
delete(w.storeMsgIDs, e.Hash())
w.storeMsgIDsMu.Unlock()