Skip to content

SlapdObject increasing waiting time #390

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

Merged
merged 2 commits into from
Nov 13, 2020

Conversation

azmeuk
Copy link
Contributor

@azmeuk azmeuk commented Nov 9, 2020

This gives a chance to SlapdObject to start faster. Notably it does not start by sleeping 1.5s anymore.

@tiran
Copy link
Member

tiran commented Nov 9, 2020

The range() timeout loop is flawed because it may wait much longer than we want. A better approach is the set a deadline with a monotonic timer, do the work, check deadline and sleep in a while loop:

deadline = time.monotonic() + 10
while True:
    # do stuff
    if time.monotonic() >= deadline:
        break
    time.sleep(0.2)

@azmeuk
Copy link
Contributor Author

azmeuk commented Nov 9, 2020

Thank you, this is indeed a much cleaner way. This is fixed.

Copy link
Contributor

@droideck droideck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@encukou encukou closed this Nov 13, 2020
@encukou encukou reopened this Nov 13, 2020
@encukou encukou merged commit 4fc9038 into python-ldap:master Nov 13, 2020
@azmeuk
Copy link
Contributor Author

azmeuk commented Nov 15, 2020

I just noticed that this patch had greatly diminished the tox execution time \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy