maybe_open_oi_feed
							parent
							
								
									77aeeaf051
								
							
						
					
					
						commit
						c8cb82639b
					
				|  | @ -856,6 +856,20 @@ async def open_oi_feed( | ||||||
|         yield chan |         yield chan | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @acm | ||||||
|  | async def maybe_open_oi_feed( | ||||||
|  | ) -> trio.abc.ReceiveStream: | ||||||
|  | 
 | ||||||
|  |     # TODO: add a predicate to maybe_open_context | ||||||
|  |     feed: to_asyncio.LinkedTaskChannel | ||||||
|  |     async with maybe_open_context( | ||||||
|  |         acm_func=open_oi_feed, | ||||||
|  |     ) as (cache_hit, feed): | ||||||
|  |         if cache_hit: | ||||||
|  |             yield broadcast_receiver(feed, 10) | ||||||
|  |         else: | ||||||
|  |             yield feed | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| # TODO, move all to `.broker` submod! | # TODO, move all to `.broker` submod! | ||||||
| # async def aio_order_feed_relay( | # async def aio_order_feed_relay( | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue