Please review this at http://codereview.appspot.com/1954041/show

Affected files:
  M bin/neso


Index: bin/neso
===================================================================
--- a/bin/neso
+++ b/bin/neso
@@ -173,8 +173,9 @@

 rpc._SOCK = _SOCK()

+CRON_RUNNING = True
 def cron():
-    while True:
+    while CRON_RUNNING:
         for dbname in Pool.database_list():
             pool = Pool(dbname)
             if 'ir.cron' not in pool.object_name_list():
@@ -184,7 +185,10 @@
                     target=cron_obj.pool_jobs,
                     args=(dbname,), kwargs={})
             thread.start()
-        time.sleep(60)
+        for i in xrange(60):
+            time.sleep(1)
+            if not CRON_RUNNING:
+                break
 thread = threading.Thread(target=cron)
 thread.start()

@@ -230,4 +234,9 @@
 DBRestore.run = DBRestore_run

 TrytonClient.run()
+CRON_RUNNING = False
+for thread in threading.enumerate():
+    if thread == threading.currentThread():
+        continue
+    thread.join()
 sys.exit()



-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpWsVB8bdgMc.pgp
Description: PGP signature

Reply via email to