Skip to content
Snippets Groups Projects
Commit 8d31ef3017c9 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

run-tests: prevent race-condition when picking a channel

Before this, multiple jobs could search the list at the same time and pick the
same free channel.

We now project this search/assignment with a simple lock.
parent eca367970253
No related branches found
No related tags found
2 merge requests!124merge stable into default,!119run-tests: fix some race condition
......@@ -2553,6 +2553,7 @@
done = queue.Queue()
running = 0
channels_lock = threading.Lock()
channels = [""] * self._jobs
def job(test, result):
......@@ -2556,13 +2557,14 @@
channels = [""] * self._jobs
def job(test, result):
for n, v in enumerate(channels):
if not v:
channel = n
break
else:
raise ValueError('Could not find output channel')
channels[channel] = "=" + test.name[5:].split(".")[0]
with channels_lock:
for n, v in enumerate(channels):
if not v:
channel = n
break
else:
raise ValueError('Could not find output channel')
channels[channel] = "=" + test.name[5:].split(".")[0]
r = None
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment