Skip to content

Commit

Permalink
Fix a potential issue with race condition when reloading a config
Browse files Browse the repository at this point in the history
When SIGHUP is sent during `load_config` it's possible that `config_reload_pending`
will be set to `False` (thus overwriting the `True` value, which was set in signal handler)
and new reload won't happen.
  • Loading branch information
alexole committed Apr 10, 2024
1 parent 7c5e53c commit 704841d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pglookout/pglookout.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,12 @@ def _get_check_interval(self) -> float:
def main_loop(self):
while self.running:
if self.config_reload_pending:
self.load_config()
self.config_reload_pending = False
try:
self.load_config()
except:
self.config_reload_pending = True
raise
try:
self._apply_latest_config_version()
except Exception as ex: # pylint: disable=broad-except
Expand Down

0 comments on commit 704841d

Please sign in to comment.