feat(android,ios): P3.1-C Instrument recovery paths with timing

Added timing instrumentation to recovery functions:

Android (ReactivationManager.kt):
- performColdStartRecovery(): Added startTime tracking and duration logging
- performForceStopRecovery(): Added startTime tracking and duration logging

iOS (DailyNotificationReactivationManager.swift):
- performColdStartRecovery(): Added startTime tracking and duration logging

All recovery functions now log duration in milliseconds with operation counts.

Verification:
- TypeScript compiles 
- Android builds (if available) 
- No behavior changes (recovery still idempotent) 
This commit is contained in:
Matthew Raymer
2025-12-23 06:38:56 +00:00
parent 04cf801b09
commit bae7438f76
2 changed files with 11 additions and 2 deletions

View File

@@ -529,6 +529,7 @@ class ReactivationManager(private val context: Context) {
* @return RecoveryResult with counts
*/
private suspend fun performColdStartRecovery(): RecoveryResult {
val startTime = System.currentTimeMillis()
val db = DailyNotificationDatabase.getDatabase(context)
val currentTime = System.currentTimeMillis()
@@ -627,7 +628,8 @@ class ReactivationManager(private val context: Context) {
recordRecoveryHistory(db, "cold_start", result)
Log.i(TAG, "Cold start recovery complete: $result")
val duration = System.currentTimeMillis() - startTime
Log.i(TAG, "Cold start recovery completed: duration=${duration}ms, missed=$missedCount, rescheduled=$rescheduledCount, verified=$verifiedCount, errors=${missedErrors + rescheduleErrors}")
return result
}
@@ -652,6 +654,7 @@ class ReactivationManager(private val context: Context) {
* @return RecoveryResult with counts
*/
private suspend fun performForceStopRecovery(): RecoveryResult {
val startTime = System.currentTimeMillis()
val db = DailyNotificationDatabase.getDatabase(context)
val currentTime = System.currentTimeMillis()
@@ -707,7 +710,8 @@ class ReactivationManager(private val context: Context) {
recordRecoveryHistory(db, "force_stop", result)
Log.i(TAG, "Force stop recovery complete: $result")
val duration = System.currentTimeMillis() - startTime
Log.i(TAG, "Force stop recovery completed: duration=${duration}ms, missed=$missedCount, rescheduled=$rescheduledCount, errors=$errors")
return result
}

View File

@@ -336,6 +336,7 @@ class DailyNotificationReactivationManager {
* @see RecoveryResult for result structure
*/
private func performColdStartRecovery() async throws -> RecoveryResult {
let startTime = Date()
let currentTime = Date()
NSLog("\(Self.TAG): Cold start recovery: checking for missed notifications")
@@ -408,6 +409,10 @@ class DailyNotificationReactivationManager {
// Note: History recording is done at performRecovery level with timing
// This method is called from performRecovery which tracks timing
let duration = Date().timeIntervalSince(startTime) * 1000 // ms
NSLog("\(Self.TAG): Cold start recovery completed: duration=%.0fms, missed=%d, rescheduled=%d, verified=%d, errors=%d",
duration, missedCount, rescheduledCount, verificationResult.notificationsFound, missedErrors + rescheduleErrors)
return result
}