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

timeouts - #11

Closed
byteface opened this issue Aug 14, 2021 · 3 comments
Closed

timeouts - #11

byteface opened this issue Aug 14, 2021 · 3 comments
Labels
help wanted Extra attention is needed
Projects

Comments

@byteface
Copy link
Owner

currently missing decent setTimout and clearTimeout methods.

I'd like these to work 2 ways. async and not. so a flag needs to be added to make async=True. currently i doubled up and 2 new ones to 'Global' so the old implementations could be left alone. (not that they worked. its just a sleep.)

ideally somehow utilise the SetInterval work that was done in the past. I had avoided ayncio due to api changes between python versions. I'd get setInterval to work in one version but it would fail in another so went to 'threads' for the Job class. howeer this is only async atm. should it block during exec?

for now I can't see me getting to this for a while. so making a ticket not to use setTimeout and clearTimeout as they aren't done. But will be once I get time and can think about how I resolve these issues.

@byteface byteface created this issue from a note in javascript (TODO) Aug 14, 2021
@byteface byteface added the help wanted Extra attention is needed label Aug 14, 2021
@byteface
Copy link
Owner Author

I've labled this as help wanted as don't think I'll get to it for 2 months at least. it's at least a weekends work for me so not on my roadmap for immediate forseeable with other stuff.

@Jordan-Cottle
Copy link
Contributor

Jordan-Cottle commented Aug 21, 2021

I think the builtin python threading.Timer would work perfectly for this.

@byteface
Copy link
Owner Author

You my friend are a genius. this is now in the 0.4.7 release. I did update it to divide/1000 to use milliseconds like the javascript one but the functionality is perfect. I tried and have also now elevated it to a module function as well as on the Global class. This ticket can be closed. Also thanks so much for the unit tests. A friend showed me the Mock object ages ago and I forget about that. Also the dunder acccessors in your assert looked like magic. Then i realised i saw that in a django app once and must've thought it was a esoteric django thing and hadn't realised you could just do that in python. weird i hadn't made the connection. I'm pretty chuffed about these 2 methods being in. so thanks again. I put your name in the contributers.md files as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Development

No branches or pull requests

2 participants