Skip to content

Commit dabb7d0

Browse files
committed
code/push: more debugging, use slightly diff sort
1 parent c9b7569 commit dabb7d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/code/push/data.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,18 @@ func sendMutableNotificationToOwner(
104104
return nil
105105
}
106106

107-
log.WithField("tokens", pushTokenRecords).Debug("Found push tokens")
107+
log.WithField("tokens", pushTokenRecords).Info("Found push tokens")
108108
slices.SortFunc(pushTokenRecords, func(a, b *push_data.Record) int {
109-
return b.CreatedAt.Compare(a.CreatedAt)
109+
return a.CreatedAt.Compare(b.CreatedAt)
110110
})
111111

112-
pushTokenRecord := pushTokenRecords[0]
112+
pushTokenRecord := pushTokenRecords[len(pushTokenRecords)-1]
113113
log = log.WithField("push_token", pushTokenRecord.PushToken)
114114

115115
// Try push
116116
switch pushTokenRecord.TokenType {
117117
case push_data.TokenTypeFcmApns:
118+
log.Info("Sending mutable push")
118119
err = pusher.SendMutableAPNSPush(
119120
ctx,
120121
pushTokenRecord.PushToken,
@@ -125,6 +126,7 @@ func sendMutableNotificationToOwner(
125126
)
126127
case push_data.TokenTypeFcmAndroid:
127128
// todo: anything special required for Android?
129+
log.Info("Sending data push")
128130
err = pusher.SendDataPush(
129131
ctx,
130132
pushTokenRecord.PushToken,

0 commit comments

Comments
 (0)