generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Problem: The current wake detector only works within a single running process. If the kernel restarts while the system was asleep, we don't detect the time discontinuity and don't reset reconnection backoffs, causing unnecessary delays.
Expected Behavior:
- Store last known timestamp in persistent storage on shutdown
- On kernel startup, compare stored timestamp with current time
- If gap exceeds threshold (e.g., > 1 hour), treat as wake event and reset all reconnection backoffs
- Complement the existing runtime wake detector (
installWakeDetector)
Implementation:
- Add timestamp storage to kernel store (e.g.,
lastNetworkActivityTimestamp) - Write timestamp on
initNetworkstop or periodically during operation - Check timestamp on
initNetworkstartup - If time gap > threshold, call
reconnectionManager.resetAllBackoffs() - Integrate with
initNetworkorinitRemoteCommsstartup sequence - Consider edge cases: clock changes, timezone issues
Acceptance Criteria:
- Last timestamp is stored on shutdown
- Time discontinuity is detected on startup
- Backoffs are reset when discontinuity detected
- Works alongside runtime wake detector
- Tests verify cross-incarnation detection
Metadata
Metadata
Assignees
Labels
No labels