-
Notifications
You must be signed in to change notification settings - Fork 17
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
Plugin keeps rewriting and recreating data.json every couple of seconds even when obsidian is minimized and not in use #6
Comments
I came here for the exact same reason. This issue is causing up to 10% CPU usage constantly. Not Obsidian causing this much usage but my syncing tool. It took me a couple of days to figure out what is causing this and deactivating this plugin finally solved my issue. So there is something going wrong there. |
And after taking a quick glance at the source I think I found one issue that could cause this. But I didn't test it yet:
I'm not that familiar with JS/TS and Obisdian plugin programming. But this seems to me like you are setting an interval to 1000ms and it is updating the date and saving the settings every 1000ms? Why would you want to do that? It would be more reasonable to save the settings only if something actually changed. And update the date at startup and every hour after that. |
did this get fixed? |
This is not yet fixed. I came here for the same reason. It's driving Obsidian sync crazy and making network traffic on my work machine very wonky. It's only a small amount of data, but, it seems like it'd be much better to allow this to be configurable or to have a setting of some sort. I love the idea of this plugin and seeing my word count, but, have currently disabled it due to this. |
A few things that can probably be done: 1. Addressing the sync issuesThis is because the plugin is writing to its
2. Debouncing updates rather than using an intervalThere's currently this bit o' logic:
Haven't looked entirely into how Potential downside: if you're a fast typer, you won't see your word count update on the status bar until you pause for less than half a second. That's still a really fast update, but not the almost real-time speed we have now. Upsides: While I doubt this would be a concern for most text files, we are currently running a bunch of regex for practically every keystroke. This would defer getting the word count of the file until the user has a brief pause. We can then also get rid of the interval, and only update our Any thoughts? |
@AndrewNatoli given the data that I see in data.json for this plugin, it seems like storing the changeset in memory until buffer close, obsidian close, etc. would be a good idea. Can render from memory and/or reading from the file for all readouts and this should be manageable for even large obsidian vaults. I believe this would drastically lower the number of updates to the file alone as there'd be no reason to write or update the file unless an editor window changed. This would also reduce the likelihood of a collision when running this on multiple computers with obsidian sync enabled. Debounced update also seems like a good idea, and honestly, if that one works as you'd expect having a configurable number so you can set the speed you'd like it to update at would be useful. One person may enjoy seeing the number fly up as they type words, while another might want it to really only update if they've paused for 10-15 seconds. I've been brainstorming for other solutions as well. I had minor hope I could just exclude this plugin's folder from sync, but, unfortunately the exclude functionality doesn't seem to be able to 'see' the .obsidian folder even if entered manually. |
It would be nice if someone who knows what they are doing update this plugin, fixing this. |
As the title says, pretty simple to explain really :D
Why is this an unwanted behavior?
- constant cpu and disk usage (my vault is in a secondary disk, it cant hibernate while not in use if a file keeps being written)
- sync app constantly working since the folder changes
Maybe stopping the updates when obsidian is minimized is better behavior since i dont know if there's any use of the plugin if you aren't using the app directly.
The text was updated successfully, but these errors were encountered: