-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #343 from goodboy/breceiver_internals
Avoid inf recursion in `BroadcastReceiver.receive()`
- Loading branch information
Showing
7 changed files
with
286 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Rework our ``.trionics.BroadcastReceiver`` internals to avoid method | ||
recursion and approach a design and interface closer to ``trio``'s | ||
``MemoryReceiveChannel``. | ||
|
||
The details of the internal changes include: | ||
|
||
- implementing a ``BroadcastReceiver.receive_nowait()`` and using it | ||
within the async ``.receive()`` thus avoiding recursion from | ||
``.receive()``. | ||
- failing over to an internal ``._receive_from_underlying()`` when the | ||
``_nowait()`` call raises ``trio.WouldBlock`` | ||
- adding ``BroadcastState.statistics()`` for debugging and testing both | ||
internals and by users. | ||
- add an internal ``BroadcastReceiver._raise_on_lag: bool`` which can be | ||
set to avoid ``Lagged`` raising for possible use cases where a user | ||
wants to choose between a [cheap or nasty | ||
pattern](https://zguide.zeromq.org/docs/chapter7/#The-Cheap-or-Nasty-Pattern) | ||
the the particular stream (we use this in ``piker``'s dark clearing | ||
engine to avoid fast feeds breaking during HFT periods). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.