You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Closes FRONT-742
### TL;DR
Added connection liveness checking to detect and clean up stale WebSocket connections.
### What changed?
- Implemented a connection liveness system that periodically checks if WebSocket and SSE connections are still active
- Added `connectionLivenessInterval` and `connectionLivenessTimeout` configuration options to the actor lifecycle settings
- Enhanced the `Conn` class with liveness tracking and checking capabilities
- Added `getConnectionReadyState` method to connection drivers to report connection status
- Created a test actor (`connLivenessActor`) and test suite to verify liveness functionality
- Implemented internal event scheduling for periodic liveness checks
- Added timestamp tracking for last seen activity on connections
### How to test?
The PR includes a comprehensive test suite in `actor-conn.ts` that verifies:
1. Connections report correct liveness status
2. Dead connections are properly detected
3. Stale connections are automatically cleaned up after the timeout period
4. Active connections continue to function normally
Run the tests with:
```
pnpm test
```
### Why make this change?
WebSocket connections can become stale or disconnected without proper notification, leading to resource leaks and potential issues with connection management. This change implements a robust mechanism to detect and clean up these stale connections automatically, improving system reliability and resource utilization.
The liveness check system ensures that the actor framework maintains an accurate view of active connections and can properly manage resources by removing connections that are no longer active.
// This state is different than `PersistedConn` state since the connection-specific state is persisted & must be serializable. This is also part of the connection driver, not part of the core actor.
@@ -25,17 +33,15 @@ export class GenericConnGlobalState {
0 commit comments