Very scary test here. Trying to see if we can boost speed on very large terminals.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
# blink = 5 if attr & 1 else 0
|
||||
# bold = 1 if attr & 16 else 0
|
||||
|
||||
import errno
|
||||
import fcntl
|
||||
import glob
|
||||
import os
|
||||
@@ -53,6 +54,9 @@ class driver(screenDriver):
|
||||
fgColorValues: Foreground color value mappings
|
||||
hichar: High character mask for Unicode support
|
||||
"""
|
||||
read_retry_attempts = 10
|
||||
read_retry_delay = 0.05
|
||||
|
||||
def __init__(self):
|
||||
screenDriver.__init__(self)
|
||||
self.ListSessions = None
|
||||
@@ -251,24 +255,40 @@ class driver(screenDriver):
|
||||
bytes: File content as bytes
|
||||
"""
|
||||
d = b""
|
||||
file.seek(0)
|
||||
try:
|
||||
d = file.read()
|
||||
except Exception as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
"vcsaDriver get_screen_text: Error reading file: " + str(e),
|
||||
debug.DebugLevel.ERROR,
|
||||
)
|
||||
for attempt in range(self.read_retry_attempts + 1):
|
||||
file.seek(0)
|
||||
while True:
|
||||
# Read from file
|
||||
try:
|
||||
chunk = file.readline(1)
|
||||
if not chunk:
|
||||
break
|
||||
d += chunk
|
||||
except Exception as e:
|
||||
try:
|
||||
return file.read()
|
||||
except OSError as e:
|
||||
if (
|
||||
e.errno == errno.EINVAL
|
||||
and attempt < self.read_retry_attempts
|
||||
):
|
||||
time.sleep(self.read_retry_delay)
|
||||
continue
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
"vcsaDriver get_screen_text: Error reading file: "
|
||||
+ str(e),
|
||||
debug.DebugLevel.ERROR,
|
||||
)
|
||||
break
|
||||
except Exception as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
"vcsaDriver get_screen_text: Error reading file: "
|
||||
+ str(e),
|
||||
debug.DebugLevel.ERROR,
|
||||
)
|
||||
break
|
||||
|
||||
file.seek(0)
|
||||
while True:
|
||||
try:
|
||||
chunk = file.readline(1)
|
||||
if not chunk:
|
||||
break
|
||||
d += chunk
|
||||
except Exception:
|
||||
break
|
||||
return d
|
||||
|
||||
def update_watchdog(self, active, event_queue):
|
||||
|
||||
Reference in New Issue
Block a user