Always close emsd data connection on close
parent
1281755d65
commit
47f823ab22
|
@ -191,7 +191,6 @@ async def maybe_open_emsd(
|
|||
yield portal
|
||||
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def open_ems(
|
||||
broker: str,
|
||||
|
@ -248,4 +247,13 @@ async def open_ems(
|
|||
with trio.fail_after(10):
|
||||
await book._ready_to_receive.wait()
|
||||
|
||||
yield book, trades_stream
|
||||
try:
|
||||
yield book, trades_stream
|
||||
|
||||
finally:
|
||||
# TODO: we want to eventually keep this up (by having
|
||||
# the exec loop keep running in the pikerd tree) but for
|
||||
# now we have to kill the context to avoid backpressure
|
||||
# build-up on the shm write loop.
|
||||
with trio.CancelScope(shield=True):
|
||||
await trades_stream.aclose()
|
||||
|
|
Loading…
Reference in New Issue