Skip to content

YAN-1568 Use SentinelQueue helper class

Callan Gray requested to merge yan-1543-stopsentinel into main

The current AsyncIterator wrappers have previously relied on a None message in it's queue to represent the end of iteration, however this pattern has the limitation that it wouldn't be able to implement an interface around optional values e.g. AsyncIterator[str | None]

Using a sentinel as suggested by @rtobar involves using a simple object() instance that can perform a reference equality check instead of value which can ensure data never unintentionally triggers the end of stream.

Merge request reports