more fixes for the pickle error.
This commit is contained in:
@@ -13,7 +13,19 @@ from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.core.eventData import FenrirEventType
|
||||
|
||||
|
||||
# Standalone worker functions for multiprocessing (cannot be instance methods)
|
||||
# Standalone functions for multiprocessing (cannot be instance methods)
|
||||
def _heart_beat_timer(running):
|
||||
"""
|
||||
Standalone heartbeat timer function for multiprocessing.
|
||||
Returns current timestamp after a short sleep.
|
||||
"""
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
except Exception as e:
|
||||
print(f"ProcessManager _heart_beat_timer: Error during sleep: {e}")
|
||||
return time.time()
|
||||
|
||||
|
||||
def _custom_event_worker_process(
|
||||
running, event_queue, function, pargs=None, run_once=False
|
||||
):
|
||||
@@ -81,7 +93,7 @@ class ProcessManager:
|
||||
self.running = self.env["runtime"]["EventManager"].get_running()
|
||||
self.add_simple_event_thread(
|
||||
FenrirEventType.heart_beat,
|
||||
self.heart_beat_timer,
|
||||
_heart_beat_timer,
|
||||
multiprocess=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@ class driver(remoteDriver):
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
# Use threading instead of multiprocessing to avoid pickle issues
|
||||
# with self.env (which contains unpicklable file handles)
|
||||
self.env["runtime"]["ProcessManager"].add_custom_event_thread(
|
||||
self.watch_dog, multiprocess=True
|
||||
self.watch_dog, multiprocess=False
|
||||
)
|
||||
|
||||
def watch_dog(self, active, event_queue):
|
||||
|
||||
@@ -20,8 +20,10 @@ class driver(remoteDriver):
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
# Use threading instead of multiprocessing to avoid pickle issues
|
||||
# with self.env (which contains unpicklable file handles)
|
||||
self.env["runtime"]["ProcessManager"].add_custom_event_thread(
|
||||
self.watch_dog, multiprocess=True
|
||||
self.watch_dog, multiprocess=False
|
||||
)
|
||||
|
||||
def watch_dog(self, active, event_queue):
|
||||
|
||||
@@ -126,8 +126,10 @@ class driver(screenDriver):
|
||||
"default", # fontfamily
|
||||
]
|
||||
) # end attribute )
|
||||
# Use threading instead of multiprocessing to avoid pickle issues
|
||||
# with self.env (which contains unpicklable file handles)
|
||||
self.env["runtime"]["ProcessManager"].add_custom_event_thread(
|
||||
self.update_watchdog, multiprocess=True
|
||||
self.update_watchdog, multiprocess=False
|
||||
)
|
||||
|
||||
def get_curr_screen(self):
|
||||
|
||||
Reference in New Issue
Block a user