Skip to content

Commit 9a378ec

Browse files
author
stroeder
committed
add and use SlapdObject._start_sleep
1 parent 447870d commit 9a378ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/slapdtest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
44
See http://www.python-ldap.org/ for details.
55
6-
\$Id: slapdtest.py,v 1.1 2017/04/26 16:52:50 stroeder Exp $
6+
\$Id: slapdtest.py,v 1.2 2017/04/26 20:46:37 stroeder Exp $
77
88
Python compability note:
99
This module only works with Python 2.7.x since
1010
"""
1111

12+
__version__ = '2.4.37'
13+
1214
import os
1315
import socket
1416
import time
@@ -106,6 +108,9 @@ class SlapdObject(object):
106108
PATH_SLAPD = os.path.join(SBINDIR, 'slapd')
107109
PATH_SLAPTEST = os.path.join(SBINDIR, 'slaptest')
108110

111+
# time in secs to wait before trying to access slapd via LDAP (again)
112+
_start_sleep = 1.5
113+
109114
def __init__(self):
110115
self._proc = None
111116
self._port = find_available_tcp_port(LOCALHOST)
@@ -183,11 +188,12 @@ def _wait_for_slapd(self):
183188
if self._proc.poll() is not None:
184189
self._stopped()
185190
raise RuntimeError("slapd exited before opening port")
191+
time.sleep(self._start_sleep)
186192
try:
187193
self._log.debug("Connecting to %s", self.ldap_uri)
188194
self.ldapwhoami()
189195
except RuntimeError:
190-
time.sleep(1)
196+
pass
191197
else:
192198
return
193199

0 commit comments

Comments
 (0)
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