Skip to content
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

One-shot timer does not deactivate properly #1477

Closed
bergmansj opened this issue Aug 23, 2023 · 1 comment
Closed

One-shot timer does not deactivate properly #1477

bergmansj opened this issue Aug 23, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bergmansj
Copy link

Description

        recording_timer = ui.timer(
            interval=60,
            callback=stop_recording,
            once=True
        )

When recording_timer.deactivate() is called on this timer before the interval runs out, the callback is still called.
I traced this to the self.active property not being checked in the _run_once method. It is properly checked in the _run_in_loop method.

I would like to be able to deactivate a timer, ie avoid the callback happening.
Also, I think it should be possible to cancel the (repeating) timer completely instead of just deactivating its callback.

@falkoschindler
Copy link
Contributor

Thanks for reporting this issue, @bergmansj!

Deactivating should, indeed, prevent the callback from happening. I fixed it in 598b805.

For canceling repeating timers I created a separate pull request #1478. There we can review and discuss this new feature.

@falkoschindler falkoschindler self-assigned this Aug 23, 2023
@falkoschindler falkoschindler added the bug Something isn't working label Aug 23, 2023
@falkoschindler falkoschindler added this to the 1.3.12 milestone Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants