def run(self): self.api.start() self.next_run = time.time() while True: logger.info(self.ha.run_cycle()) reap_children() self.schedule_next_run()
def run(self): self.api.start() self.next_run = time.time() while True: self.touch_member() logger.info(self.ha.run_cycle()) try: self.ha.cluster and self.ha.state_handler.sync_replication_slots(self.ha.cluster) except: logger.exception('Exception when changing replication slots') reap_children() self.schedule_next_run()
def run(self): self.api.start() self.next_run = time.time() while not self._received_sigterm: if self._received_sighup: self._received_sighup = False if self.config.reload_local_configuration(): self.reload_config() logger.info(self.ha.run_cycle()) cluster = self.dcs.cluster if cluster and cluster.config and self.config.set_dynamic_configuration(cluster.config): self.reload_config() if not self.postgresql.data_directory_empty(): self.config.save_cache() reap_children() self.schedule_next_run()
def test_reap_children(self): self.assertIsNone(reap_children()) with patch('os.waitpid', Mock(return_value=(0, 0))): sigchld_handler(None, None) self.assertIsNone(reap_children())
def test_reap_children(self): reap_children() with patch("os.waitpid", Mock(return_value=(0, 0))): sigchld_handler(None, None) reap_children()
def test_reap_children(self): reap_children() os.waitpid = os_waitpid sigchld_handler(None, None) reap_children()