mknx / smarthome

http://mknx.github.io/smarthome/
GNU General Public License v3.0
126 stars 68 forks source link

Scheduler fail #208

Open kr2 opened 7 years ago

kr2 commented 7 years ago

I didn't look into this issue to much, because using threading directly works and bypasses this problem. So this means I am not 100% certain of the following.

It seems that the scheduler expects the tasks do be finite. So if there are some task like the following, then scheduler fails to execute some of them. The problem there is that it does so without error message.

self._sh.scheduler.add('test_1', self._worker, prio=3, cron='init', cycle=None, value=None, offset=None, next=None)
self._sh.scheduler.add('test_2', self._worker, prio=3, cron='init', cycle=None, value=None, offset=None, next=None)
...
def _worker(self):
    while self.alive:
        pass

The scheduler also seems to miss task if the cycle time is to short.

self._sh.scheduler.add('test_1', self._worker, prio=3, cron=None, cycle=1, value=None, offset=None, next=None)
self._sh.scheduler.add('test_2', self._worker, prio=3, cron=None, cycle=1, value=None, offset=None, next=None)
...