wakatime / sublime-wakatime

Sublime Text 2 & 3 plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/sublime-text
BSD 3-Clause "New" or "Revised" License
526 stars 47 forks source link

Timeout should be called on main thread? #34

Closed sisou closed 9 years ago

sisou commented 9 years ago

After fixing my plugin as described in https://github.com/wakatime/sublime-wakatime/issues/33#issuecomment-85512368, timetracking works and the WakaTime.com server receives my heartbeats.

Nonetheless, WakaTime is still emiting an apparently non-critical error:

Exception in thread Thread-36:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\WakaTime.py", line 181, in run
  File ".\WakaTime.py", line 228, in send_heartbeat
  File ".\WakaTime.py", line 233, in sent
RuntimeError: Must call on main thread, consider using sublime.set_timeout(function, timeout)

Edit: This is in fact a critical error, as it prevents the plugin from setting it's LAST_ACTION variable which in turn makes the plugin call the API on each keypress.

sisou commented 9 years ago

It appears this happens due to WakaTime now using the system's Python, which is executed in another thread (not Sublime's main one).

alanhamlett commented 9 years ago

Yes, this is a pretty bad bug. I've fixed it with 48bbab33b4d8575ec5bef81fea2bb195815799e8 so v3.0.13 should be working now.

sisou commented 9 years ago

Thank you! :+1: I hope it doesn't mean a regression in ST3.

Can I just add: Works like a charm now! So awesome! Thank you! :smiley: