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:
@@ -529,6 +529,7 @@ class ReactivationManager(private val context: Context) {
|
|||||||
* @return RecoveryResult with counts
|
* @return RecoveryResult with counts
|
||||||
*/
|
*/
|
||||||
private suspend fun performColdStartRecovery(): RecoveryResult {
|
private suspend fun performColdStartRecovery(): RecoveryResult {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
val db = DailyNotificationDatabase.getDatabase(context)
|
val db = DailyNotificationDatabase.getDatabase(context)
|
||||||
val currentTime = System.currentTimeMillis()
|
val currentTime = System.currentTimeMillis()
|
||||||
|
|
||||||
@@ -627,7 +628,8 @@ class ReactivationManager(private val context: Context) {
|
|||||||
|
|
||||||
recordRecoveryHistory(db, "cold_start", result)
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,6 +654,7 @@ class ReactivationManager(private val context: Context) {
|
|||||||
* @return RecoveryResult with counts
|
* @return RecoveryResult with counts
|
||||||
*/
|
*/
|
||||||
private suspend fun performForceStopRecovery(): RecoveryResult {
|
private suspend fun performForceStopRecovery(): RecoveryResult {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
val db = DailyNotificationDatabase.getDatabase(context)
|
val db = DailyNotificationDatabase.getDatabase(context)
|
||||||
val currentTime = System.currentTimeMillis()
|
val currentTime = System.currentTimeMillis()
|
||||||
|
|
||||||
@@ -707,7 +710,8 @@ class ReactivationManager(private val context: Context) {
|
|||||||
|
|
||||||
recordRecoveryHistory(db, "force_stop", result)
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -336,6 +336,7 @@ class DailyNotificationReactivationManager {
|
|||||||
* @see RecoveryResult for result structure
|
* @see RecoveryResult for result structure
|
||||||
*/
|
*/
|
||||||
private func performColdStartRecovery() async throws -> RecoveryResult {
|
private func performColdStartRecovery() async throws -> RecoveryResult {
|
||||||
|
let startTime = Date()
|
||||||
let currentTime = Date()
|
let currentTime = Date()
|
||||||
|
|
||||||
NSLog("\(Self.TAG): Cold start recovery: checking for missed notifications")
|
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
|
// Note: History recording is done at performRecovery level with timing
|
||||||
// This method is called from performRecovery which tracks 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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user