From 9d035b475840b484e38e0b5f1f609e18fea877a3 Mon Sep 17 00:00:00 2001 From: "David E. Eisenstat" Date: Sat, 23 Jun 2007 11:49:58 +0000 Subject: [PATCH] Bug in startup logic that led slices new at bootup to be started twice. --- accounts.py | 6 +++++- sm.py | 13 ++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/accounts.py b/accounts.py index 1b8c8a8..b0ec4c2 100644 --- a/accounts.py +++ b/accounts.py @@ -29,6 +29,9 @@ import logger import tools +# When this variable is true, start after any ensure_created +startingup = False + # shell path -> account class association shell_acct_class = {} # account type -> account class association @@ -116,7 +119,8 @@ class Worker: finally: self._create_sem.release() if not isinstance(self._acct, next_class): self._acct = next_class(rec) else: self._acct.configure(rec) - if next_class != curr_class: self._acct.start() + if next_class != curr_class || startingup: + self._acct.start() def ensure_destroyed(self): self._q.put((self._ensure_destroyed,)) def _ensure_destroyed(self): self._destroy(self._get_class()) diff --git a/sm.py b/sm.py index e159213..81667c7 100644 --- a/sm.py +++ b/sm.py @@ -175,15 +175,7 @@ def GetSlivers(data, fullupdate=True): database.db.deliver_record(rec) if fullupdate: database.db.set_min_timestamp(data['timestamp']) database.db.sync() - - # handle requested startup - global start_requested - if start_requested: - start_requested = False - cumulative_delay = 0 - for name in database.db.iterkeys(): - accounts.get(name).start(delay=cumulative_delay) - cumulative_delay += 3 + accounts.startingup = False def deliver_ticket(data): return GetSlivers(data, fullupdate=False) @@ -194,8 +186,7 @@ def start(options, config): accounts.register_class(sliver_vs.Sliver_VS) accounts.register_class(delegate.Delegate) - global start_requested - start_requested = options.startup + accounts.startingup = options.startup database.start() api.deliver_ticket = deliver_ticket api.start() -- 2.43.0