+ result = []
+ for _ in range(FORM_COUNT):
+ row = selection.fetchone()
+ if row is not None:
+ question = dict(zip(names, row))
+ result.append(question)
+ elif depth < RECCUR_DEPTH:
+ logger.error(f"User {key} ran out of questions. Waiting and reccuring")
+
+ dispatch = True
+ for th in threading.enumerate():
+ if th.name == f"g{key}":
+ dispatch = False
+ logger.warning(f"Generator {key} attempted to dispatch, but was already running")
+
+ if dispatch:
+ logger.info(f"Generator {key} re-dispatched within recursion (depth {depth})")
+ threading.Thread(target=generate_questions, args=(key,), name=f"g{key}").start()
+
+ time.sleep(RECCUR_WAIT)
+ result = get_questions(key, depth+1)
+ else:
+ logger.error(f"User {key} maximum depth reached")
+ quit()