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
# eventually block this producer end of the feed and
# thus other consumers still attached.
subs = bus._subscribers[sym]
subs = bus._subscribers[sym.lower()]
for ctx in subs:
# print(f'sub is {ctx.chan.uid}')
try:

View File

@ -203,7 +203,10 @@ async def allocate_persistent_feed(
# TODO: make this into a composed type which also
# contains the backfiller cs for individual super-based
# 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:
# start history backfill task ``backfill_bars()`` is
@ -272,7 +275,12 @@ async def attach_feed_bus(
ctx=ctx,
bus=bus,
brokername=brokername,
# here we pass through the selected symbol in native
# "format" (i.e. upper vs. lowercase depending on
# provider).
symbol=symbol,
loglevel=loglevel,
)
)
@ -411,7 +419,7 @@ async def install_brokerd_search(
provider_name=brokermod.name,
search_routine=search,
pause_period=brokermod._search_conf.get('pause_period'),
pause_period=brokermod._search_conf.get('pause_period', 0.0616),
):
yield

View File

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

View File

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