refactor: Enhance GenerationJobManager with improved subscriber handling

- Updated RuntimeJobState to include allSubscribersLeftHandlers for managing client disconnections without affecting subscriber count.
- Refined createJob and subscribe methods to ensure generation starts only when the first real client connects.
- Added detailed documentation for methods and properties to clarify the synchronization of job generation with client readiness.
- Improved logging for subscriber checks and event handling to facilitate debugging and monitoring.
This commit is contained in:
Danny Avila 2025-12-12 02:36:44 -05:00
parent ff86f96416
commit 9fb7594ebe
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
3 changed files with 107 additions and 21 deletions

View file

@ -112,6 +112,9 @@ export interface IEventTransport {
/** Get subscriber count for a stream */
getSubscriberCount(streamId: string): number;
/** Check if this is the first subscriber (for ready signaling) */
isFirstSubscriber(streamId: string): boolean;
/** Listen for all subscribers leaving */
onAllSubscribersLeft(streamId: string, callback: () => void): void;
}