@@ -630,26 +630,25 @@ showServer' = decodeLatin1 . strEncode . host
630630ntfPush :: NtfPushServer -> M ()
631631ntfPush s@ NtfPushServer {pushQ} = forever $ do
632632 (srvHost_, tkn@ NtfTknRec {ntfTknId, token = t, tknStatus}, ntf) <- atomically (readTBQueue pushQ)
633- let (pp, _) = deviceTokenFields t
634- liftIO $ logDebug $ " sending push notification to " <> T. pack (show pp)
633+ logDebug $ " sending push notification to " <> tshow (tokenPushProvider t)
635634 st <- asks store
636635 case ntf of
637636 PNVerification _ ->
638- liftIO (deliverNotification st pp tkn ntf) >>= \ case
637+ liftIO (deliverNotification st tkn ntf) >>= \ case
639638 Right _ -> do
640639 void $ liftIO $ setTknStatusConfirmed st tkn
641640 incNtfStatT t ntfVrfDelivered
642641 Left _ -> incNtfStatT t ntfVrfFailed
643642 PNCheckMessages -> do
644- liftIO (deliverNotification st pp tkn ntf) >>= \ case
643+ liftIO (deliverNotification st tkn ntf) >>= \ case
645644 Right _ -> do
646645 void $ liftIO $ updateTokenCronSentAt st ntfTknId . systemSeconds =<< getSystemTime
647646 incNtfStatT t ntfCronDelivered
648647 Left _ -> incNtfStatT t ntfCronFailed
649648 PNMessage {} -> checkActiveTkn tknStatus $ do
650649 stats <- asks serverStats
651650 liftIO $ updatePeriodStats (activeTokens stats) ntfTknId
652- liftIO (deliverNotification st pp tkn ntf) >>= \ case
651+ liftIO (deliverNotification st tkn ntf) >>= \ case
653652 Left _ -> do
654653 incNtfStatT t ntfFailed
655654 liftIO $ mapM_ (`incServerStat` ntfFailedOwn stats) srvHost_
@@ -662,8 +661,8 @@ ntfPush s@NtfPushServer {pushQ} = forever $ do
662661 checkActiveTkn status action
663662 | status == NTActive = action
664663 | otherwise = liftIO $ logError " bad notification token status"
665- deliverNotification :: NtfPostgresStore -> PushProvider -> NtfTknRec -> PushNotification -> IO (Either PushProviderError () )
666- deliverNotification st pp tkn@ NtfTknRec {ntfTknId} ntf = do
664+ deliverNotification :: NtfPostgresStore -> NtfTknRec -> PushNotification -> IO (Either PushProviderError () )
665+ deliverNotification st tkn@ NtfTknRec {ntfTknId, token } ntf = do
667666 deliver <- getPushClient s pp
668667 runExceptT (deliver tkn ntf) >>= \ case
669668 Right _ -> pure $ Right ()
@@ -679,6 +678,7 @@ ntfPush s@NtfPushServer {pushQ} = forever $ do
679678 PPInvalidPusher -> err e
680679 _ -> err e
681680 where
681+ pp = tokenPushProvider token
682682 retryDeliver :: IO (Either PushProviderError () )
683683 retryDeliver = do
684684 deliver <- newPushClient s pp
0 commit comments