Skip to content

Handler chain is recreated for every gateway event #2

@01Dri

Description

@01Dri

The handler chain is created via HandlerFactory.CreateHandlerChain for every gateway event received.
While functional, this approach introduces unnecessary object allocations and makes it harder to share state across handlers.

Problem

  • Repeated object creation per event
  • Increased allocation and GC pressure
  • Architecture not well suited for future extensions (e.g. views, callback caching)

Suggested improvement

  • Instantiate the handler chain once per gateway connection
  • Reuse the same instance throughout the gateway lifecycle

Impact

  • Reduced allocation overhead
  • More predictable execution flow
  • Stronger architectural base for upcoming features

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions