question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In decorators.interruptible_sleep, use event.wait instead of polling every second

See original GitHub issue

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
JesseTGcommented, Mar 2, 2018

Oh, I understand now. This matters when an event is supplied, and will mean that twarc will stop sleeping immediately if a supplied event has fired? It’s less an issue of performance and more an issue of responsiveness?

I was using the terms interchangeably, but yes, you could say that. Also, sleeping this way does free up the GIL, which would be important if multi-threading of any kind was ever added.

If you send me a PR I will test & merge it.

You got it. Love this project, by the way. Super convenient.

1reaction
JesseTGcommented, Mar 2, 2018

@hugovk Ah, forgot about the GIL. So you’re telling me that when running in Python 2 there wouldn’t be as much a difference (since the sleeping is done in Python), but in Python 3 there would be?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python time.sleep() vs event.wait() - Stack Overflow
I use Event.wait in this situation even though python 2.x is polling in the background. Sleeping at, say, 1 second intervals is reasonably ......
Read more >
Polling by sleeping versus polling by waiting with a timeout
The second one will use 2. But is the first scenario wasting more thread time? Is it worth using the event (kernel object)?”....
Read more >
Are the states of processes which are ready and scheduled to ...
A process that is waiting to be scheduled isn't idle: the reason it ... S interruptible sleep (waiting for an event to complete)...
Read more >
comp.programming.threads FAQ - Dan Luu
If I use a SPARC 10, the program only takes 1 second to terminate. Is SPARC 2000 slower than a SPARC 10? 2....
Read more >
Linux.System.Programming by Andy L - Issuu
In the rare event of a system call with more than five parameters, a single ... Instead, Linux aims toward compliance with two...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found