Store lowercase symbols within piker data internals

symbol_search
Tyler Goodlet 2021-05-25 06:17:18 -04:00
parent af9dcf9230
commit 59475cfd81
4 changed files with 13 additions and 5 deletions

View File

@ -227,7 +227,8 @@ async def sample_and_broadcast(
# end up triggering backpressure which which will # end up triggering backpressure which which will
# eventually block this producer end of the feed and # eventually block this producer end of the feed and
# thus other consumers still attached. # thus other consumers still attached.
subs = bus._subscribers[sym] subs = bus._subscribers[sym.lower()]
for ctx in subs: for ctx in subs:
# print(f'sub is {ctx.chan.uid}') # print(f'sub is {ctx.chan.uid}')
try: try:

View File

@ -203,7 +203,10 @@ async def allocate_persistent_feed(
# TODO: make this into a composed type which also # TODO: make this into a composed type which also
# contains the backfiller cs for individual super-based # contains the backfiller cs for individual super-based
# resspawns when needed. # resspawns when needed.
bus.feeds[symbol] = (cs, init_msg, first_quote)
# XXX: the ``symbol`` here is put into our native piker format (i.e.
# lower case).
bus.feeds[symbol.lower()] = (cs, init_msg, first_quote)
if opened: if opened:
# start history backfill task ``backfill_bars()`` is # start history backfill task ``backfill_bars()`` is
@ -272,7 +275,12 @@ async def attach_feed_bus(
ctx=ctx, ctx=ctx,
bus=bus, bus=bus,
brokername=brokername, brokername=brokername,
# here we pass through the selected symbol in native
# "format" (i.e. upper vs. lowercase depending on
# provider).
symbol=symbol, symbol=symbol,
loglevel=loglevel, loglevel=loglevel,
) )
) )
@ -411,7 +419,7 @@ async def install_brokerd_search(
provider_name=brokermod.name, provider_name=brokermod.name,
search_routine=search, search_routine=search,
pause_period=brokermod._search_conf.get('pause_period'), pause_period=brokermod._search_conf.get('pause_period', 0.0616),
): ):
yield yield

View File

@ -1538,7 +1538,6 @@ async def chart_symbol(
}, },
}) })
async with trio.open_nursery() as n: async with trio.open_nursery() as n:
# load initial fsp chain (otherwise known as "indicators") # load initial fsp chain (otherwise known as "indicators")
@ -1598,6 +1597,7 @@ async def load_providers(
# search engines. # search engines.
for broker in brokernames: for broker in brokernames:
log.info(f'Loading brokerd for {broker}')
# spin up broker daemons for each provider # spin up broker daemons for each provider
portal = await stack.enter_async_context( portal = await stack.enter_async_context(
maybe_spawn_brokerd( maybe_spawn_brokerd(

View File

@ -497,7 +497,6 @@ async def fill_results(
search: SearchBar, search: SearchBar,
symsearch: Callable[..., Awaitable], symsearch: Callable[..., Awaitable],
recv_chan: trio.abc.ReceiveChannel, recv_chan: trio.abc.ReceiveChannel,
# cached_symbols: Dict[str,
# kb debouncing pauses # kb debouncing pauses
min_pause_time: float = 0.0616, min_pause_time: float = 0.0616,