summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Torres <adt@odoo.com>2017-11-27 11:12:27 +0100
committerGitHub <noreply@github.com>2017-11-27 11:12:27 +0100
commitac5ba4a2b0ab75a42d86a5aa04a0e837de64ffff (patch)
tree8cbdfb07e87a7f0d64b4eac1e5ca6a51c0533de1
parentb46830858f44b83b185df4f83e20aad69b48d330 (diff)
[FIX] server: do not restart if phoenix is True (#21209)
Before this commit, saving a file being watched by watchdog (--dev=reload) with vim (and possibly other text editors) would crash the server via a KeyboardInterrupt error. This happens because vim, emacs cause multiple filesystem events to happen when saving a single file, the FSWatcher registers these events as multiple SIGHUPs which in turn calls restart() multiple times in a very small amount of time which makes the KeyboardInterrupts completely shut down the server This is fixed by only calling restart() if odoo.phoenix is False, since catching a SIGHUP sets it to true. Fixes #21178 Special thanks to @odony for the help :)
-rw-r--r--odoo/service/server.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py
index 835ecd3b27a..000fe096250 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -140,8 +140,9 @@ class FSWatcher(object):
except SyntaxError:
_logger.error('autoreload: python code change detected, SyntaxError in %s', path)
else:
- _logger.info('autoreload: python code updated, autoreload activated')
- restart()
+ if not getattr(odoo, 'phoenix', False):
+ _logger.info('autoreload: python code updated, autoreload activated')
+ restart()
def start(self):
self.observer.start()