Closed phettberg closed 1 month ago
When instantiating ThreadBasedCyclicSendTask by calling bus.send_periodic, with a certain duration, the task won't start again after calling .start
ThreadBasedCyclicSendTask
bus.send_periodic
.start
The problem is, that self.end_time is only set at init in broadcastmanager.py
self.end_time
self.end_time: Optional[float] = ( time.perf_counter() + duration if duration else None )
Then it only works the first time when the thread is started immediately
while not self.stopped: if self.end_time is not None and time.perf_counter() >= self.end_time: break
However, it should be set again, either in .start() or in _run().
.start()
_run()
I guess this might affect #1848 #1853 as well.
example_task
modifier_callback
example_task.start()
The defined periodic task should start again, with the same duration and interval.
OS and version: Ubuntu 24.04.1 LTS Python version: 3.12.3 python-can version: 4.4.2 python-can interface/s (if applicable): socketcan and IXXAT
Describe the bug
When instantiating
ThreadBasedCyclicSendTask
by callingbus.send_periodic
, with a certain duration, the task won't start again after calling.start
The problem is, that
self.end_time
is only set at init in broadcastmanager.pyThen it only works the first time when the thread is started immediately
However, it should be set again, either in
.start()
or in_run()
.I guess this might affect #1848 #1853 as well.
To Reproduce
ThreadBasedCyclicSendTask
objectexample_task
by callingbus.send_periodic
, including amodifier_callback
and a duration of five secondsexample_task.start()
Expected behavior
The defined periodic task should start again, with the same duration and interval.
Additional context
OS and version: Ubuntu 24.04.1 LTS Python version: 3.12.3 python-can version: 4.4.2 python-can interface/s (if applicable): socketcan and IXXAT
Traceback and logs