Don't sleep on less than zero delay

kivy_mainline_and_py3.8
Tyler Goodlet 2018-02-13 12:13:04 -05:00
parent 472ff68811
commit 62bac7b2cd
1 changed files with 4 additions and 2 deletions

View File

@ -328,8 +328,9 @@ async def poll_tickers(
last = _cache.setdefault(symbol, {})
timekey = 'lastTradeTime'
if quote[timekey] != last.get(timekey):
new = set(quote.items()) - set(last.items())
log.info(
f"New quote {quote['symbol']} @ {quote[timekey]}")
f"New quote {quote['symbol']} @ {quote[timekey]}:\n{new}")
_cache[symbol] = quote
payload.append(quote)
else:
@ -342,7 +343,8 @@ async def poll_tickers(
delay = sleeptime - proc_time
if delay <= 0:
log.warn(f"Took {proc_time} seconds for processing quotes?")
await trio.sleep(delay)
else:
await trio.sleep(delay)
async def api(methname: str, **kwargs) -> dict: