[MERGE] Merge from openerp-web.
[odoo/odoo.git] / openerp-server
index 9e3f36c..3586b11 100755 (executable)
@@ -100,7 +100,7 @@ if not ( config["stop_after_init"] or \
 
 if config['db_name']:
     for dbname in config['db_name'].split(','):
-        db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
+        db, pool = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
         cr = db.cursor()
 
         if config["test_file"]:
@@ -108,8 +108,7 @@ if config['db_name']:
             openerp.tools.convert_yaml_import(cr, 'base', file(config["test_file"]), {}, 'test', True)
             cr.rollback()
 
-        # jobs will start to be processed later, when openerp.cron.start_master_thread below is called.
-        registry.schedule_cron_jobs()
+        pool.get('ir.cron')._poolJobs(db.dbname)
 
         cr.close()
 
@@ -153,7 +152,7 @@ if config["translate_in"]:
 if config["stop_after_init"]:
     sys.exit(0)
 
-openerp.cron.start_master_thread()
+openerp.netsvc.start_agent()
 
 #----------------------------------------------------------
 # Launch Servers
@@ -199,8 +198,7 @@ if os.name == 'posix':
     signal.signal(signal.SIGQUIT, dumpstacks)
 
 def quit():
-    # stop scheduling new jobs; we will have to wait for the jobs to complete below
-    openerp.cron.cancel_all()
+    openerp.netsvc.Agent.quit()
     openerp.netsvc.Server.quitAll()
     if config['pidfile']:
         os.unlink(config['pidfile'])
@@ -216,10 +214,9 @@ def quit():
         if thread != threading.currentThread() and not thread.isDaemon():
             while thread.isAlive():
                 # need a busyloop here as thread.join() masks signals
-                # and would prevent the forced shutdown
+                # and would present the forced shutdown
                 thread.join(0.05)
                 time.sleep(0.05)
-    openerp.modules.registry.RegistryManager.delete_all()
     sys.exit(0)
 
 if config['pidfile']: