Add 6, 6s retries on feed resets

ib_dedicated_data_client
Tyler Goodlet 2022-06-01 12:12:35 -04:00
parent a5389beccd
commit 8d6c5b214e
1 changed files with 17 additions and 12 deletions

View File

@ -1592,20 +1592,26 @@ async def get_bars(
# # 'Market data farm connection is OK:usfuture' # # 'Market data farm connection is OK:usfuture'
# 'Market data farm connection is OK:usfarm' # 'Market data farm connection is OK:usfarm'
# ) # )
# TODO: some kinda resp here that indicates success
# otherwise retry?
# port = proxy._aio_ns.ib.client.port # port = proxy._aio_ns.ib.client.port
await data_reset_hack() await data_reset_hack()
# TODO: a while loop here if we timeout? # try to wait on the reset event(s) to arrive, a timeout
# will trigger a retry up to 6 times (for now).
for i in range(6):
with trio.move_on_after(6) as cs:
for name, ev in [ for name, ev in [
('history', hist_ev), ('history', hist_ev),
# ('live', live_ev), # ('live', live_ev),
]: ]:
await ev.wait() await ev.wait()
log.info(f"{name} DATA RESET") log.info(f"{name} DATA RESET")
break
fails += 1 fails += 1
if cs.cancelled_caught:
log.warning(f'Data reset hack failed, retrying {i}...')
continue continue
else: else:
@ -2554,7 +2560,6 @@ async def data_reset_hack(
async with asyncvnc.connect( async with asyncvnc.connect(
'localhost', 'localhost',
port=5900, port=5900,
force_video_mode='rgba',
) as client: ) as client:
client.mouse.click() client.mouse.click()