Debounced Event Filter #319
Replies: 8 comments 24 replies
-
Hi, I can agree on this. There has been some dicussion about this earlier, but maybe I could use your topic as the main topic for this feature from now on and do some further planning on it. A quote from my comment in #284:
Also #287 talks about this. So, some design principles:
Consider implementing
|
Beta Was this translation helpful? Give feedback.
-
Hi, I came here to ask something similar, this would be really useful for me too. |
Beta Was this translation helpful? Give feedback.
-
Testers for event debouncing? 🙂Hi everybody! I think I've got the event debouncing developed to a pretty good phase now and it will be released in version I have written a documentation page for this. I'll publish it later here when the test is open, but if you want to read it already now, you can find it here on GitHub: https://github.com/Taitava/obsidian-shellcommands-documentation/blob/0.22.0/Events/Events%20-%20debouncing.md I'll probably develop a few more features before making a beta (or actual) release, so this is just a pre-announcement. Please react to this message with a 👍 if you are interested to do some beta testing. I don't have a schedule when the test will be open and when it will close, but take your time, no need to hurry when testing. If you decide to participate, all I'm asking is short feedback about the feature and documentation after you've tested it. If all is working well to your liking, just a short "all ok" comment is enough 🙂. But of course all problem reports and ideas of improvement are very valuable to this project! I'll tag here people that have been interested in this feature in the past. I hope I'm not missing anybody. It would be great if some of you could take part in testing when I get it ready. Also, others can participate, too! 😎 Thank you! 🌞 |
Beta Was this translation helpful? Give feedback.
-
Should the cooldown time be prolonged if an event triggering is detected?Currently, in SC An example configuration:
Scenario:
If some kind of prolonging mechanism would be developed, further event triggerings during a cooldown phase would "restart" the cooldown so that the shell command would only be executed once, after the user stops typing for five seconds. Any opinions on this? If something like this would be implemented (perhaps in a subsequent |
Beta Was this translation helpful? Give feedback.
-
I've been experimenting with this and it all seems good. But I have one issue which is probably something to do with what I am trying to do … A more trivial script (logging the date to an external file for example), doesn't suffer this problem. I need to experiment more, I'm not entirely sure what's happening. |
Beta Was this translation helpful? Give feedback.
-
Documentation feedback: On this page for File Content Modified triggers, you might want to change the warnings to include using debouncing as an option. |
Beta Was this translation helpful? Give feedback.
-
My testing: BRAT is cool. When I first went to the new settings page, the version was the beta, but the debounce option wasn't there. I restarted obsidian and it showed up. This was my first attempt at it. My use case is a git sync script. It does To test, I opened a terminal and ran With this setup, I could type anything and immediately got a new commit (good). After 5s, I would type something else, and I did not get a commit. After a minute, I typed something and I did get a commit. I switched the type to "Execute, cooldown, execute again if needed". I could type something, see the commit (1 second ago) and type something else. After 35s, the second commit would be made. This 35s seems repeatable. I expected that cooldown to be 5s. UPDATE: I think this might be the git push command taking 30s. I'm not sure why it is 30s or why it is so consistent, but 35s is fine with me. My goal with this shell command is just to make sure the git server has an identical copy of what is here locally, and the local copy is exactly what is on the server. I don't imagine I will be in a situation where I switch from one local computer to another fast enough to cause a merge issue or anything. As long as the syncs are happening quickly enough for me to get synced by the time I get to the other machine, this will be fine. If it was 10 minutes, that's probably too long. But 5s or 35s is a reasonable "frame rate" for "human interface time". I would like to make sure it gets the last update on obsidian quits. Maybe I should just copy the shell command and disable debounce on the second. It's not a huge deal (and having any debounce is a huge deal IMO). So not a deal breaker. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Shell Commands to execute a bash git script to keep my notes synced with my server. I am using the "File content modified" event and it is killing itself trying to keep up, now that my notes are large enough that git takes any amount of time.
I am considering ways to fix this. One really excellent way would be to add a "debounce" to the event in SC. I am using lodash.debounce on one of my FOSS projects: https://docs-lodash.com/v4/debounce/ . My crappy code use is here: https://github.com/jeffeb3/sandify/blob/master/src/components/InputOption.js#L12 (this just waits to update the display until the user has stopped typing for 1.5s).
The way I imagine this working is a user defined number of seconds (with zero to disable, or maybe a separate event type, IDK). If they set 5s, then the event would keep feeding the debounce with updated information. As soon as 5s had elapsed without any new calls to debounce, the event would trigger. This would ensure the final event always fired, and it would drop intermediate events that were just updating things that were already out of date. The absolute "minimum viable product" would be to create a second "File content modified" event, with a name like "File content updated", and it always does this debounce.
That is my take on it. You may want to think about making this more widely available, or how to make it clear to the users.
I can probably find another solution or work around in the "user space". Something like a bash version of debounce, or making the shell command just touch a file on the system when there was a change, and have a cron job periodically check that file, and call the git push script. But that only solves it for me.
Beta Was this translation helpful? Give feedback.
All reactions