[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 :)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user