self.threads = []
for i in range(self.nr_concurrent_jobs):
- self.threads.append(JobThread(self, volume_client, name="{0}.{1}".format(self.name_pfx, i)))
- self.threads[-1].start()
+ self.spawn_new_thread(i)
self.start()
+ def spawn_new_thread(self, suffix):
+ t_name = f'{self.name_pfx}.{time.time()}.{suffix}'
+ log.debug(f'spawning new thread with name {t_name}')
+ t = JobThread(self, self.vc, name=t_name)
+ t.start()
+
+ self.threads.append(t)
+
def set_wakeup_timeout(self):
with self.lock:
# not made configurable on purpose
# Increase concurrency: create more threads.
log.debug("creating new threads to job increase")
for i in range(c, self.nr_concurrent_jobs):
- self.threads.append(JobThread(self, self.vc, name="{0}.{1}.{2}".format(self.name_pfx, time.time(), i)))
- self.threads[-1].start()
+ self.spawn_new_thread(i)
self.cv.wait(timeout=self.wakeup_timeout)
def shutdown(self):