wakatime / jetbrains-wakatime

IntelliJ IDEA, PyCharm, RubyMine, PhpStorm, AppCode, AndroidStudio, Goland, Rider, & WebStorm plugin for quantifying your coding.
https://wakatime.com/intellij-idea
BSD 3-Clause "New" or "Revised" License
1.13k stars 167 forks source link

Incorrect time tracking phpstorm #183

Closed sanasol closed 3 years ago

sanasol commented 3 years ago

PhpStorm 2021.2 Build #PS-212.4746.100, built on July 28, 2021 Subscription is active until August 27, 2021. Runtime version: 11.0.11+9-b1504.13 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.5.2 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 12 Registry: run.processes.with.pty=TRUE, ide.balloon.shadow.size=0 Non-Bundled Plugins: com.wakatime.intellij.plugin (13.0.2), zielu.gittoolbox (212.7.6), com.deadlock.scsyntax (212.4746.57), de.espend.idea.laravel (0.15.4), ru.adelf.idea.dotenv (2021.3.0.212)

Noticed it about ~2 weeks ago(since 13 august). IDLE time tracked like work with random opened file.

Time tracked while phpstorm not focused even. Also probably problem is getting worse when opened multiple projects at once.

Looks like it in worst case: image

Here is log with wakatime debug enabled sometimes. idea.log

Checked idea.log and I see that possible problem is GitToolBox plugin, WakaTime triggered every time autofetch or blame executed. But it wasn't problem before. So probably should be some fix.

alanhamlett commented 3 years ago

Yes, Saving Project sounds like it would trigger the on-save event that WakaTime listens for:

42661 2021-08-25 13:18:42,176 [1902703]   INFO - rationStore.ComponentStoreImpl - Saving Project(name=myproject, containerState=COMPONENT_CREATED, componentStore=/Users/user/code/lpt-v1)GitToolBoxBlamePersistence took 14 ms

I'll install that plugin and see if we can ignore these events.

sanasol commented 3 years ago

I changed autofetch from 15 minutes to 30 minutes and it looks good now, will continue to check. Probably long enough so wakatime dont track it.

alanhamlett commented 3 years ago

I was able to reproduce it after installing GitToolBox. That extension periodically annotates files with git blame hints, which triggers IntelliJ's documentChanged event tricking WakaTime into thinking the file was edited.

It's fixed with 18ad7d171bb95f30a52c4e2034d706ddc4b674f4 and released in v13.0.3, so updating your WakaTime extension will fix it.