Doh, set sleeptime after adjusting the rate limit

kivy_mainline_and_py3.8
Tyler Goodlet 2018-04-18 13:31:07 -04:00
parent 030ecdcce8
commit dd5e1e7ea7
1 changed files with 3 additions and 3 deletions

View File

@ -139,14 +139,14 @@ async def poll_tickers(
A broker-client ``quoter`` async context manager must be provided which A broker-client ``quoter`` async context manager must be provided which
returns an async quote function. returns an async quote function.
""" """
sleeptime = round(1. / rate, 3)
_cache = {} # ticker to quote caching
broker_limit = getattr(brokermod, '_rate_limit', float('inf')) broker_limit = getattr(brokermod, '_rate_limit', float('inf'))
if broker_limit < rate: if broker_limit < rate:
rate = broker_limit rate = broker_limit
log.warn(f"Limiting {brokermod.__name__} query rate to {rate}/sec") log.warn(f"Limiting {brokermod.__name__} query rate to {rate}/sec")
sleeptime = round(1. / rate, 3)
_cache = {} # ticker to quote caching
while True: # use an event here to trigger exit? while True: # use an event here to trigger exit?
prequote_start = time.time() prequote_start = time.time()