(self)
| 111 | # print(f"Connection testing took {end_time - start_time} seconds") |
| 112 | |
| 113 | def test_connections(self): |
| 114 | def test_url(client): |
| 115 | try: |
| 116 | # Check if server provides the system.listMethods function. |
| 117 | client.server.system.listMethods() |
| 118 | return True |
| 119 | except Exception as e: |
| 120 | print(f"Failed to connect to {client.url}. Error: {str(e)}") |
| 121 | return False |
| 122 | |
| 123 | start_time = time.perf_counter() |
| 124 | futures = [ |
| 125 | self.executor.submit(test_url, client) for client in self.clients |
| 126 | ] |
| 127 | results = [f.result() for f in futures] |
| 128 | end_time = time.perf_counter() |
| 129 | # print(f"Testing connections took {end_time - start_time} seconds") |
| 130 | # Remove clients that failed to connect |
| 131 | self.clients = [ |
| 132 | client for client, result in zip(self.clients, results) if result |
| 133 | ] |
| 134 | if not self.clients: |
| 135 | raise Exception("Failed to connect to all URLs") |
| 136 | |
| 137 | def query_all(self, method, *args): |
| 138 | start_time = time.perf_counter() |
nothing calls this directly
no outgoing calls
no test coverage detected