def pre_work(
self,
task,
):
self.update_current_task(
task=task,
)
interval = self.worker_config['timeouts']['soft_timeout']
if interval == 0:
interval = None
self.current_timers[threading.get_ident()] = threading.Timer(
interval=interval,
function=ctypes.pythonapi.PyThreadState_SetAsyncExc,
args=(
ctypes.c_long(threading.get_ident()),
ctypes.py_object(worker.WorkerSoftTimedout),
)
)
self.current_timers[threading.get_ident()].start()
评论列表
文章目录