-
Notifications
You must be signed in to change notification settings - Fork 263
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
Reworking mkDebounce
#996
Reworking mkDebounce
#996
Conversation
Hmmm, seeing the random failing in CI jobs, this is probably a timing issue? And the Now to figure out if the test should be adjusted, or if there is actually an error in the implementation... |
I figured it out. It was the I think this fixes the leaking of threads and adds two styles of debouncing that are also pretty common. |
Windows nightly fails with: ... who's fault would this be? 🤔 EDIT: Ah... rerunning fixes it. That's dumb 🤷 |
ddb4081
to
a4ec84d
Compare
commit ddb4081 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 14:03:24 2024 +0100 add PR number and URL to Changelog commit ffecec5 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 14:02:58 2024 +0100 remove custom build directory commit 1eeceb4 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 13:06:49 2024 +0100 and fix the CI commit 27c6ff9 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:50:20 2024 +0100 upped version in cabal file commit 4246ff5 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:49:41 2024 +0100 documentation fix commit 16a20ca Merge: b9e7aad 23b8c4c Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:42:07 2024 +0100 Merge branch 'master' into trying-to-rework-Control-Debounce commit b9e7aad Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:26:54 2024 +0100 added to Changelog commit 73deb77 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:26:39 2024 +0100 auto-update/test: adjusted tests for new 'DebounceEdge' tests commit f0ba37b Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sun Oct 27 12:26:08 2024 +0100 auto-update: fixed debounce to not leak threads and also added two new 'DebounceEdge' types. Also improved (hopefully) the documentation commit a0f9e92 Author: Felix Paulusma <felix.paulusma@gmail.com> Date: Sat Jun 8 23:17:01 2024 +0200 auto-update: reworked 'mkDebounce', and it should work... but i'Leading' only works if I put a 'trace' in a specific spot???
b5cedbe
to
f368fc4
Compare
Oh god, https://github.com/yesodweb/wai/actions/runs/11641886813/job/32420880212?pr=996 |
@Vlix Is this PR ready for reviewing? |
@kazu-yamamoto Yes, I hope with this last commit (and |
…on those GHC versions, and no longer supporting GHC 8.10.7. I think it's time to drop it; we're at GHC 9.12 almost
Apparently my new |
…n't test that. Did extend the test to verify a trigger does at least restart the timer
When this is merged, I'll update the CI in #1011 to include |
DI.DebounceSettings, | ||
defaultDebounceSettings, | ||
|
||
-- * Accessors | ||
-- ** Accessors | ||
DI.debounceFreq, | ||
DI.debounceAction, | ||
DI.debounceEdge, |
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.
I wonder why DebounceEdge
is NOT exported while deboundeEdge
is exported.
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.
Never mind.
leadingEdge
should be used instead of Leading
.
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.
LGTM
Rebased and merged. |
Ok, so I've tried to rework the debouncing, because of issue #980, but it seems to fail on a test because the trigger
MVar
doesn't seem to be correctly filled unless I put atrace
in a specific spot!?Does anyone know how to force/evaluate (or whatever is happening here) the
tryPutMVar
without usingtrace
?Still TODO:
After submitting your PR: