From cf5780e426b69713ba04b608c4a2195bda015776 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 15 Jun 2023 16:23:13 +0200 Subject: [PATCH] node-proxy: add a timeout when posting data if this call is stuck for any reason, the report will block the whole daemon given that at this point it has acquired a lock. We need to make sure this call won't block the daemon for a long time, let's add a timeout. Signed-off-by: Guillaume Abrioux (cherry picked from commit a3aff1b848a3785dd2e3752a79c8c819e6445239) --- src/cephadm/node-proxy/reporter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cephadm/node-proxy/reporter.py b/src/cephadm/node-proxy/reporter.py index 6be8d24c6b0..3636e1ab3fa 100644 --- a/src/cephadm/node-proxy/reporter.py +++ b/src/cephadm/node-proxy/reporter.py @@ -36,7 +36,8 @@ class Reporter: log.logger.info('data has changed since last iteration.') d = self.system.get_system() try: - requests.post(f"{self.observer_url}/fake_endpoint", json=d) + # TODO: add a timeout parameter to the reporter in the config file + requests.post(f"{self.observer_url}/fake_endpoint", json=d, timeout=5) except requests.exceptions.RequestException as e: log.logger.error(f"The reporter couldn't send data to the mgr: {e}") # Need to add a new parameter 'max_retries' to the reporter if it can't -- 2.47.3