Don't sleep on less than zero delay
parent
472ff68811
commit
62bac7b2cd
|
@ -328,8 +328,9 @@ async def poll_tickers(
|
||||||
last = _cache.setdefault(symbol, {})
|
last = _cache.setdefault(symbol, {})
|
||||||
timekey = 'lastTradeTime'
|
timekey = 'lastTradeTime'
|
||||||
if quote[timekey] != last.get(timekey):
|
if quote[timekey] != last.get(timekey):
|
||||||
|
new = set(quote.items()) - set(last.items())
|
||||||
log.info(
|
log.info(
|
||||||
f"New quote {quote['symbol']} @ {quote[timekey]}")
|
f"New quote {quote['symbol']} @ {quote[timekey]}:\n{new}")
|
||||||
_cache[symbol] = quote
|
_cache[symbol] = quote
|
||||||
payload.append(quote)
|
payload.append(quote)
|
||||||
else:
|
else:
|
||||||
|
@ -342,6 +343,7 @@ async def poll_tickers(
|
||||||
delay = sleeptime - proc_time
|
delay = sleeptime - proc_time
|
||||||
if delay <= 0:
|
if delay <= 0:
|
||||||
log.warn(f"Took {proc_time} seconds for processing quotes?")
|
log.warn(f"Took {proc_time} seconds for processing quotes?")
|
||||||
|
else:
|
||||||
await trio.sleep(delay)
|
await trio.sleep(delay)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue