File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -188,25 +188,19 @@ func (p *PushOutput) Start() error {
188
188
return nil
189
189
}
190
190
191
- // AddNewFcmTokens adds only the new FCM tokens to the fcmTokens slice
192
- func (p * PushOutput ) AddNewFcmTokens () {
191
+ // refreshFcmTokens adds only the new FCM tokens to the fcmTokens slice
192
+ func (p * PushOutput ) refreshFcmTokens () {
193
193
tokenMap := GetFcmTokens ()
194
- existingTokens := make (map [string ]bool , len (p .fcmTokens ))
195
194
196
- for _ , token := range p .fcmTokens {
197
- existingTokens [token ] = true
198
- }
199
-
200
- for _ , newToken := range tokenMap {
201
- if _ , exists := existingTokens [newToken ]; ! exists {
202
- p .fcmTokens = append (p .fcmTokens , newToken )
203
- }
195
+ p .fcmTokens = p .fcmTokens [:0 ]
196
+ for token := range tokenMap {
197
+ p .fcmTokens = append (p .fcmTokens , token )
204
198
}
205
199
}
206
200
207
201
func (p * PushOutput ) processFcmNotifications (title , body string ) {
208
202
// Fetch new FCM tokens and add to p.fcmTokens
209
- p .AddNewFcmTokens ()
203
+ p .refreshFcmTokens ()
210
204
211
205
// If no FCM tokens exist, log and exit
212
206
if len (p .fcmTokens ) == 0 {
You can’t perform that action at this time.
0 commit comments