Clean up all cached Pub/Sub clients.
()
| 151 | |
| 152 | |
| 153 | def cleanup_clients(): |
| 154 | """Clean up all cached Pub/Sub clients.""" |
| 155 | global _publisher_client_cache, _subscriber_client_cache |
| 156 | |
| 157 | with _publisher_client_lock: |
| 158 | for client, _ in _publisher_client_cache.values(): |
| 159 | client.transport.close() |
| 160 | _publisher_client_cache.clear() |
| 161 | |
| 162 | with _subscriber_client_lock: |
| 163 | for client, _ in _subscriber_client_cache.values(): |
| 164 | client.close() |
| 165 | _subscriber_client_cache.clear() |