[FIX] stop related crons when closing a database
authorChristophe Simonis <chs@openerp.com>
Tue, 18 Jan 2011 19:26:37 +0000 (20:26 +0100)
committerChristophe Simonis <chs@openerp.com>
Tue, 18 Jan 2011 19:26:37 +0000 (20:26 +0100)
bzr revid: chs@openerp.com-20110118192637-i0yyyo86pa2hzq1d

bin/sql_db.py

index a7d46d7..b1822f6 100644 (file)
@@ -3,6 +3,7 @@
 #
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -53,6 +54,7 @@ psycopg2.extensions.register_type(psycopg2.extensions.new_type((700, 701, 1700,)
 
 import tools
 from tools.func import wraps, frame_codeinfo
+from netsvc import Agent
 from datetime import datetime as mdt
 from datetime import timedelta
 import threading
@@ -382,6 +384,7 @@ def db_connect(db_name):
 
 def close_db(db_name):
     _Pool.close_all(dsn(db_name))
+    Agent.cancel(db_name)
     tools.cache.clean_caches_for_db(db_name)
     ct = currentThread()
     if hasattr(ct, 'dbname'):