Skip to content

feat: centralized PluginResourceManager interface for consistent async cleanup across all channel plugins #48793

@alex-xuweilong

Description

@alex-xuweilong

Context

PR #48588 fixes async server cleanup for Feishu, but the same pattern (sync server.close() without awaiting) likely exists in other channel plugins (Telegram, Slack, Discord, etc.). Each plugin implements cleanup differently, leading to recurring port leak and memory leak bugs.

Proposal

Introduce a PluginResourceManager interface that all channel plugins implement:

  • start(accountId): async resource initialization
  • stop(accountId): async cleanup with proper await
  • cleanup(): full teardown with timeout guards

The gateway can then track all plugin resources centrally and ensure proper cleanup before restart.

Follow-up from #48183 / #48588. Credit to @Artyomkun for the architectural suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions