Skip to content

Add hassette_event_buffer_size configuration field #321

@jessica-claude

Description

@jessica-claude

Description

The Hassette core event stream buffer size is currently hardcoded to 1000 items, while the web API event buffer is configurable via web_api_event_buffer_size (default 500). This inconsistency makes it impossible for users to tune the core stream buffer based on their event volume.

Current code (core.py:90):

self._send_stream, self._receive_stream = create_memory_object_stream[...](1000)

Config precedent (config.py):

web_api_event_buffer_size: int = Field(default=500, ...)

Motivation

  • Users with high event volume may need larger buffers to prevent backpressure
  • Users with low event volume may want smaller buffers to reduce memory footprint
  • Consistency: if web_api_event_buffer_size is configurable, core stream should be too
  • Tunability: event buffer size affects performance and should be user-controlled

Acceptance Criteria

  • Add hassette_event_buffer_size field to HassetteConfig (default 1000 to preserve current behavior)
  • Update core.py line 90 to use self.config.hassette_event_buffer_size instead of hardcoded 1000
  • Add docstring explaining what this controls and when users might tune it
  • Add test in test_config.py verifying the field exists and defaults to 1000
  • Update documentation if config is documented elsewhere

Source

Identified during codebase audit on 2026-02-26.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configConfiguration / settingsenhancementNew feature or requestsize:smallQuick win, < 1 hour

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions