@@ -115,11 +115,12 @@ class StartRequestCache: RequestCache {
115115}
116116
117117class ReceiveReceiptsRequestCache : RequestCache {
118- // Keep receive receipts requests for up to 30 days.
119- static let OneMonthInSeconds = TimeInterval ( 60 * 60 * 24 * 30 )
118+ // Sent receipts are kept as dedup markers, so bound retention: an active activity re-emits for at most
119+ // ~12h on relaunch, and updates arrive over the network, so a day covers dedup and retries without piling up.
120+ static let OneDayInSeconds = TimeInterval ( 60 * 60 * 24 )
120121
121122 init ( ) {
122- super. init ( cacheKey: OS_LIVE_ACTIVITIES_EXECUTOR_RECEIVE_RECEIPTS_KEY, ttl: ReceiveReceiptsRequestCache . OneMonthInSeconds )
123+ super. init ( cacheKey: OS_LIVE_ACTIVITIES_EXECUTOR_RECEIVE_RECEIPTS_KEY, ttl: ReceiveReceiptsRequestCache . OneDayInSeconds )
123124 }
124125}
125126
@@ -141,10 +142,11 @@ class OSLiveActivitiesExecutor: OSPushSubscriptionObserver {
141142
142143 // The live activities request dispatch queue, serial. This synchronizes access to `updateTokens` and `startTokens`.
143144 private var requestDispatch : OSDispatchQueue
144- private var pollIntervalSeconds = 30
145+ private var pollIntervalSeconds : Int
145146
146- init ( requestDispatch: OSDispatchQueue ) {
147+ init ( requestDispatch: OSDispatchQueue , pollIntervalSeconds : Int = 30 ) {
147148 self . requestDispatch = requestDispatch
149+ self . pollIntervalSeconds = pollIntervalSeconds
148150 }
149151
150152 func start( ) {
@@ -184,7 +186,7 @@ class OSLiveActivitiesExecutor: OSPushSubscriptionObserver {
184186 }
185187 }
186188
187- private func pollPendingRequests( ) {
189+ func pollPendingRequests( ) {
188190 OneSignalLog . onesignalLog ( . LL_VERBOSE, message: " OneSignal.LiveActivities pollPendingRequests " )
189191
190192 self . requestDispatch. asyncAfterTime ( deadline: . now( ) + . seconds( pollIntervalSeconds) ) { [ weak self] in
0 commit comments