# When this variable is true, start after any ensure_created
-startingup = False
-# Cumulative delay for starts when startingup is true
+Startingup = False
+# Cumulative delay for starts when Startingup is true
+csd_lock = threading.Lock()
cumstartdelay = 0
# shell path -> account class association
def ensure_created(self, rec):
"""Cause the account specified by <rec> to exist if it doesn't already."""
- self._q.put((self._ensure_created, rec.copy()))
+ self._q.put((self._ensure_created, rec.copy(), Startingup))
- def _ensure_created(self, rec):
+ def _ensure_created(self, rec, startingup):
curr_class = self._get_class()
next_class = type_acct_class[rec['type']]
if next_class != curr_class:
if not isinstance(self._acct, next_class): self._acct = next_class(rec)
else: self._acct.configure(rec)
if startingup:
+ csd_lock.acquire()
global cumstartdelay
- self._acct.start(delay=cumstartdelay)
+ delay = cumstartdelay
cumstartdelay += 2
+ csd_lock.release()
+ self._acct.start(delay=delay)
elif next_class != curr_class or self._acct.initscriptchanged:
self._acct.start()
try:
cmd = self._q.get()
cmd[0](*cmd[1:])
- except: logger.log_exc()
+ except:
+ logger.log_exc(self.name)