mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-03 16:07:00 +00:00
Do not block the event loop with time.sleep in the async clients
nodediscover's rescan poll and nodeconsole's screenshot refresh both slept with time.sleep inside a coroutine. In nodeconsole --video that stops the input handler and the VNC streaming tasks for the whole interval.
This commit is contained in:
@@ -910,7 +910,7 @@ async def do_screenshot():
|
||||
dorefresh = False
|
||||
else:
|
||||
dorefresh = True
|
||||
time.sleep(options.interval)
|
||||
await asyncio.sleep(options.interval)
|
||||
sys.exit(0)
|
||||
|
||||
async def grab_vncs(urlbynode):
|
||||
|
||||
@@ -20,7 +20,6 @@ import csv
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
path = os.path.realpath(os.path.join(path, '..', 'lib', 'python'))
|
||||
@@ -364,7 +363,7 @@ async def assign_discovery(options, session, needid=True):
|
||||
async def blocking_scan(session):
|
||||
list([x async for x in session.update('/discovery/rescan', {'rescan': 'start'})])
|
||||
while(list([x async for x in session.read('/discovery/rescan')])[0].get('scanning', False)):
|
||||
time.sleep(0.5)
|
||||
await asyncio.sleep(0.5)
|
||||
list([x async for x in session.update('/networking/macs/rescan', {'rescan': 'start'})])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user