Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
S
subplot
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 0
    • Merge requests 0
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Lars Wirzenius
  • subplot
  • Issues
  • #166

Closed
Open
Created Feb 16, 2021 by Lars Wirzenius@larswirzeniusMaintainer

daemon.py busy-waits for port to be open

The code that waits for the daemon to have opened its port is essentially:

while True:
    try:
        s = socket.create_connection(addr, timeout=timeout)
        s.close()
        return
    except socket.timeout:
        logging.error(f"daemon did not respond at port {port} within {timeout} seconds")
        raise
    except socket.error as e:
        logging.info(f"could not connect to daemon at {port}: {e}")
        pass

Would it not make sense to have a time.sleep(0.1) instead of pass on the last line? It shouldn't affect the total time to wait in any significant manner, but would reduce the number of times the loop is iterated significantly.

Assignee
Assign to
Iteration starting 2021-03-13
Milestone
Iteration starting 2021-03-13 (Past due)
Assign milestone
Time tracking