diff --git a/mysql_ch_replicator/utils.py b/mysql_ch_replicator/utils.py index cba8f5c..77338ba 100644 --- a/mysql_ch_replicator/utils.py +++ b/mysql_ch_replicator/utils.py @@ -45,11 +45,15 @@ def restart_dead_process_if_required(self): logger.warning(f'Restarting stopped process: < {self.cmd} >') self.run() return + res = self.process.poll() if res is None: - # still running + # Process is running fine. return - logger.warning(f'Restarting dead process: < {self.cmd} >') + + logger.warning(f'Process dead (exit code: {res}), restarting: < {self.cmd} >') + # Process has already terminated, just reap it + self.process.wait() self.run() def stop(self):