Don't sleep on less than zero delay
parent
472ff68811
commit
62bac7b2cd
|
@ -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,6 +343,7 @@ async def poll_tickers(
|
|||
delay = sleeptime - proc_time
|
||||
if delay <= 0:
|
||||
log.warn(f"Took {proc_time} seconds for processing quotes?")
|
||||
else:
|
||||
await trio.sleep(delay)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue