Skip to content

Fix proxy video server inits#1598

Open
zanhesl wants to merge 9 commits intopocketnetteam:masterfrom
zanhesl:ai-fixes
Open

Fix proxy video server inits#1598
zanhesl wants to merge 9 commits intopocketnetteam:masterfrom
zanhesl:ai-fixes

Conversation

@zanhesl
Copy link
Contributor

@zanhesl zanhesl commented Jan 26, 2026

Standards checklist:

  • The PR title is descriptive
  • There is no PR that addresses this issue
  • The PR has self-explained commits history
  • The code is mine or has Apache-2.0 compatible license
  • The code is efficient enough, it respects user resources
  • The code is stable and tested
  • There is new functionality, information is provided below

Changes:

  • Fix server removing
  • Fix server initialisation logic
  • Start fixing video-cabinet

Other comments:

...

- Project description
- Cursor directives
The videoCabinet component was attempting to connect to offline video servers, causing errors. Updated the availableInstances() method in roy.js to filter out both old and offline servers, preventing connection attempts to servers marked as online: false in the bastyon-peertubes repository.
Fixed inverted comparison operator (== to !=) in removeInstance() that caused
memory leak by keeping removed instances instead of filtering them out.
Added reference validation and defensive checks in addInstance(), removeInstance(),
and destroy() to prevent counter operations on deleted/replaced instance records.
Added state validation checks to prevent requests, stats access, and server
selection on destroyed instances. Returns safe defaults or clear error codes
('INSTANCE_DESTROYED', 'INSTANCE_NOT_USABLE') instead of undefined behavior.
Made instance.init() properly async by awaiting getinfo() and only setting
inited=true on success. Added cleanup on failure (clear interval, destroy
statistic). Log failures in roy.js without blocking instance creation.
Added self.instanses = {} and inited = false to destroy() to properly reset
state. Prevents stale instance references across restarts that caused counter
desynchronization and memory leaks.
This reverts commit 459b700.

The async initialization approach was causing issues with instance availability.
Reverting to synchronous initialization pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant