Skip to content

Commit cad9b0a

Browse files
committed
code/push: way more debugging
1 parent 00919a9 commit cad9b0a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pkg/code/push/data.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ func sendMutableNotificationToOwner(
9999
return err
100100
}
101101

102+
log.WithField("tokens", pushTokenRecords).Info("Found push tokens")
103+
102104
seenPushTokens := make(map[string]struct{})
103105
for _, pushTokenRecord := range pushTokenRecords {
104106
// Dedup push tokens, since they may appear more than once per app install
@@ -112,6 +114,7 @@ func sendMutableNotificationToOwner(
112114
var err error
113115
switch pushTokenRecord.TokenType {
114116
case push_data.TokenTypeFcmApns:
117+
log.Info("Sending mutable push")
115118
err = pusher.SendMutableAPNSPush(
116119
ctx,
117120
pushTokenRecord.PushToken,
@@ -122,6 +125,7 @@ func sendMutableNotificationToOwner(
122125
)
123126
case push_data.TokenTypeFcmAndroid:
124127
// todo: anything special required for Android?
128+
log.Info("Sending data push")
125129
err = pusher.SendDataPush(
126130
ctx,
127131
pushTokenRecord.PushToken,

pkg/code/server/grpc/chat/v2/server.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ func (s *Server) SendMessage(ctx context.Context, req *chatpb.SendMessageRequest
791791
}
792792

793793
s.onPersistChatMessage(log, chatId, chatMessage)
794+
795+
log.Info("Sending push notifications from SendMessage()")
794796
s.sendPushNotifications(chatId, chatTitle, memberId, chatMessage)
795797

796798
return &chatpb.SendMessageResponse{
@@ -1423,11 +1425,20 @@ func (s *Server) sendPushNotifications(chatId chat.ChatId, chatTitle string, sen
14231425
return
14241426
}
14251427

1428+
log.WithField("members", members).Info("Found members for push")
1429+
14261430
var eg errgroup.Group
14271431
eg.SetLimit(min(32, len(members)))
14281432

14291433
for _, m := range members {
1434+
log := log.WithField("member", m.MemberId.String())
14301435
if m.MemberId == sender || m.IsMuted || m.IsUnsubscribed {
1436+
log.WithFields(logrus.Fields{
1437+
"isSender": m.MemberId == sender,
1438+
"isMuted": m.IsMuted,
1439+
"isUnsubscribed": m.IsUnsubscribed,
1440+
}).Info("skipping member")
1441+
14311442
continue
14321443
}
14331444

0 commit comments

Comments
 (0)