PLT-7502 fixing clearing of push notifications for iOS (#7429)

* PLT-7502 fixing clearing of push notificaitons for iOS

* PLT-7502 fixing clearing of push notificaitons for iOS
Этот коммит содержится в:
Corey Hulen
2017-09-12 17:49:42 -07:00
коммит произвёл GitHub
родитель 4731b8f9b9
Коммит 3e9bd30b00

Просмотреть файл

@@ -649,10 +649,18 @@ func (a *App) sendPushNotification(post *model.Post, user *model.User, channel *
return nil return nil
} }
func (a *App) ClearPushNotification(userId string, channelId string) *model.AppError { func (a *App) ClearPushNotification(userId string, channelId string) {
go func() {
// Sleep is to allow the read replicas a chance to fully sync
// the unread count for sending an accurate count.
// Delaying a little doesn't hurt anything and is cheaper than
// attempting to read from master.
time.Sleep(time.Second * 5)
sessions, err := a.getMobileAppSessions(userId) sessions, err := a.getMobileAppSessions(userId)
if err != nil { if err != nil {
return err l4g.Error(err.Error())
return
} }
msg := model.PushNotification{} msg := model.PushNotification{}
@@ -673,8 +681,7 @@ func (a *App) ClearPushNotification(userId string, channelId string) *model.AppE
tmpMessage.SetDeviceIdAndPlatform(session.DeviceId) tmpMessage.SetDeviceIdAndPlatform(session.DeviceId)
go a.sendToPushProxy(tmpMessage, session) go a.sendToPushProxy(tmpMessage, session)
} }
}()
return nil
} }
func (a *App) sendToPushProxy(msg model.PushNotification, session *model.Session) { func (a *App) sendToPushProxy(msg model.PushNotification, session *model.Session) {