]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
node-proxy: add a timeout when posting data
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 15 Jun 2023 14:23:13 +0000 (16:23 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 25 Jan 2024 14:43:30 +0000 (14:43 +0000)
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 <gabrioux@ibm.com>
src/cephadm/node-proxy/reporter.py

index 6be8d24c6b0ae696867fbd2f1b7d703d83f1bec2..3636e1ab3fa6bfd45e63362f1fe77bbf23d4e1be 100644 (file)
@@ -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