-
Notifications
You must be signed in to change notification settings - Fork 13
Timeouts implementation #46
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
base: main
Are you sure you want to change the base?
Conversation
if on_timeout: | ||
on_timeout() | ||
|
||
if timeout > 0: |
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.
From what I can tell, this only works for timeouts that are explicitly specified by the dev.
There's also the default timeout of the desktop environment/notification daemon that will get applied when timeout == -1
- ideally, the callback should be invoked even in that case. This will likely need platform-specific code though.
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.
Apologies for not looking at this earlier.
The general approach makes sense to me, but note that platform-supported timeout will still work even if the app / Python is no longer running.
Therefore, I'd prefer to check if the backend supports timeouts and use the manual mechanism only if it doesn't.
This might mean moving any timeout implementation into backends, or querying supported functionality. There is some basic support in the 5.0.0 dev release now for backends to report their capabilities, but this does not (yet) allow for the API layer to add functionality where missing by the backend.
Could you also update the platform support docs and changelog as part of this PR?
Resolves #38, resolves #43
This might not be the best approach. I think it should be tested a bit more.