-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actually send heartbeats in appropriate situation, as stated in docs #7
Conversation
and file_uri == _last_heartbeat_file | ||
and now - _last_heartbeat_time < ACTION_FREQUENCY | ||
): | ||
logger.debug("Not necessary to send heartbeat") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will generate too many logs, how about leaving this code but commenting it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only debug logs, so it's printed only with env GEDIT_WAKATIME_PLUGIN_DEBUG=1
, and there are two other messages from this plugin emitted in the same sequence anyway. Should this really be commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the plugin already has debug logs on every cursor change, so this one more is fine too.
Btw, what is the desired behavior with unsaved files ('Untitled document 1' etc.)? Currently, we're logging them just by this name, but after some digging, I found a way to detect them: location = document.get_file().get_location()
if location is None:
print("Unsaved file")
else:
print(location.get_path()) # likely the same as get_uri_for_display() (?) |
For unsaved files, all other editor plugins exclude sending any heartbeat. In current master I've updated the code to match that and prevent heartbeats for unsaved files. |
See https://wakatime.com/help/creating-plugin#plugin-overview
I believe this deserves a version bump, as it changes heartbeat frequency significantly.
I've also found some other minor issues in the plugin, I'll address these in a separate issue