Bug in startup logic that led slices new at bootup to be started twice.
authorDavid E. Eisenstat <deisenst@cs.princeton.edu>
Sat, 23 Jun 2007 11:49:58 +0000 (11:49 +0000)
committerDavid E. Eisenstat <deisenst@cs.princeton.edu>
Sat, 23 Jun 2007 11:49:58 +0000 (11:49 +0000)
accounts.py
sm.py

index 1b8c8a8..b0ec4c2 100644 (file)
@@ -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 (file)
--- 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()