Skip to content

Dropping old events #26

@OskarZyg

Description

@OskarZyg

When dispatching events to exceed the max size, the following occurs:

2026-03-25 11:56:12,915 - asyncio - ERROR - Exception in callback EventBus.dispatch()
handle: <Handle EventBus.dispatch()>
Traceback (most recent call last):
  File "/usr/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cs1822/.local/lib/python3.13/site-packages/bubus/event_bus.py", line 1221, in dispatch
    return self.emit(event)
           ~~~~~~~~~^^^^^^^
  File "/home/cs1822/.local/lib/python3.13/site-packages/bubus/event_bus.py", line 1161, in emit
    raise RuntimeError(
    ...<2 lines>...
    )
RuntimeError: io#00ca🟢(queue=0 active=0 history=10 handlers=2) history limit reached (10/10); set event_history.max_history_drop=True to drop old history instead of rejecting new events

However, this is contradictory to the README.md, which clearly states:

When max_history_size is set, EventBus automatically removes old events when the limit is exceeded

Additionally, following the exception's suggestion:

    self.event_bus.event_history.max_history_drop=True
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'max_history_drop'

The documentation and exceptions both contradict each other, and neither solution they propose works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions