remove non-used resources; update gitignore with virtualenvs; try only 5 times instead of 10
This commit is contained in:
parent
9abbe10db4
commit
36766a5c23
3
.gitignore
vendored
3
.gitignore
vendored
@ -23,3 +23,6 @@ __pycache__/
|
||||
.idea
|
||||
|
||||
*.egg-info
|
||||
|
||||
venv/
|
||||
ENV/
|
||||
@ -340,15 +340,19 @@ class UnixSimulatorPipe:
|
||||
self.close()
|
||||
raise RuntimeError("Cannot connect to simulator. Is it running?")
|
||||
|
||||
instance = 0
|
||||
while instance < 10:
|
||||
last_err = None
|
||||
for instance in range(5):
|
||||
pn = '/tmp/ckcc-client-%d-%d.sock' % (os.getpid(), instance)
|
||||
try:
|
||||
self.pipe.bind(pn) # just needs any name
|
||||
break
|
||||
except OSError:
|
||||
instance += 1
|
||||
except OSError as err:
|
||||
last_err = err
|
||||
if os.path.exists(pn):
|
||||
os.remove(pn)
|
||||
continue
|
||||
else:
|
||||
raise last_err # raise whatever was raised last in the loop
|
||||
|
||||
self.pipe_name = pn
|
||||
atexit.register(self.close)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user