tingbot / tingbot-python

🔩 Python APIs to write apps for Tingbot
Other
18 stars 9 forks source link

Fix bug with timer scheduling #56

Closed furbrain closed 7 years ago

furbrain commented 7 years ago

Problem: You create a new timer, to be run every 1/30th of a second. You would expect this timer to either run imemdiately, or at least within 1/30 of a second. However, in _wait, it waits until the next timer is due - which can be quite some time, at least 700ms on a test I have done, which causes a marked lag in response (specifically on scrolling large lists).

Solution: pass wait a callable rather than an absolute time to wait until - this allows the wait routine to dynamically check whether the next timer is due or not

joerick commented 7 years ago

Good idea! I remember considering this once before. I guess the main case this bug would happen is when a timer is added during a wait callback.