Lock cron table at the transaction starts
If the lock is not taken at the transaction starts since c8771e45b861 an exception is raised. Closes #12248
This commit is contained in:
@@ -161,10 +161,11 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
|
||||
logger.info('cron started for "%s"', db_name)
|
||||
now = datetime.datetime.now()
|
||||
retry = config.getint('database', 'retry')
|
||||
with transaction.start(db_name, 0, context={'_skip_warnings': True}):
|
||||
with transaction.start(
|
||||
db_name, 0, context={'_skip_warnings': True},
|
||||
_lock_tables=[cls._table]):
|
||||
pool = Pool()
|
||||
Error = pool.get('ir.error')
|
||||
cls.lock()
|
||||
crons = cls.search(['OR',
|
||||
('next_call', '<=', now),
|
||||
('next_call', '=', None),
|
||||
|
||||
Reference in New Issue
Block a user