Jeeze, don't overwrite the payload for each channel...

kivy_mainline_and_py3.8
Tyler Goodlet 2018-12-17 19:15:29 -05:00
parent 5af90c044f
commit d4e36b1e55
1 changed files with 4 additions and 7 deletions

View File

@ -158,17 +158,14 @@ async def fan_out_to_chans(
diff_cached=diff_cached, diff_cached=diff_cached,
): ):
chan_payloads = {} chan_payloads = {}
payload = {}
for quote in quotes: for quote in quotes:
# is this too QT specific?
symbol = quote['symbol']
payload[symbol] = quote
# set symbol quotes for each subscriber # set symbol quotes for each subscriber
for chan, cid in symbols2chans.get(quote['key'], set()): # for chan, cid in symbols2chans.get(quote['key'], set()):
for chan, cid in symbols2chans[quote['key']]:
chan_payloads.setdefault( chan_payloads.setdefault(
chan, chan,
{'yield': payload, 'cid': cid} {'yield': {}, 'cid': cid}
) )['yield'].update({quote['symbol']: quote})
# deliver to each subscriber (fan out) # deliver to each subscriber (fan out)
if chan_payloads: if chan_payloads: