Skip to content

Adding selectors has two KeyError exceptions in the success path #106664

Closed
@bdraco

Description

@bdraco

Similar to #106527, adding a new asyncio reader has to hit _SelectorMapping.__getitem__ which is expected to raise and catch KeyError twice since the reader will not yet be in the map.

When connections are constantly being added and removed because devices are being polled over http/websocket the overhead of adding/removing readers adds up.

For a webserver with connections constantly being added/removed, the cost of adding and removing impacts how many clients can be handled

Another place I see this come up is with dbus connections which need to get torn down and created at fast clip when dealing with bluetooth devices.

See #106527 (comment) and #106527 (comment) for where this was split from

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions