Returns a storage client.
(self)
| 110 | |
| 111 | @property |
| 112 | def client(self): |
| 113 | """Returns a storage client.""" |
| 114 | |
| 115 | # make sure it's thread-safe, as creating a new client is expensive |
| 116 | with self._client_lock: |
| 117 | if self._client and self._pid == getpid(): |
| 118 | return self._client |
| 119 | # make sure each process gets its own connection after a fork |
| 120 | self._client = Client(project=self.project) |
| 121 | self._pid = getpid() |
| 122 | |
| 123 | # config the number of connections to the server |
| 124 | adapter = requests.adapters.HTTPAdapter( |
| 125 | pool_connections=self._threadpool_maxsize, |
| 126 | pool_maxsize=self._threadpool_maxsize, |
| 127 | max_retries=3, |
| 128 | ) |
| 129 | client_http = self._client._http |
| 130 | client_http.mount("https://", adapter) |
| 131 | client_http._auth_request.session.mount("https://", adapter) |
| 132 | |
| 133 | return self._client |
| 134 | |
| 135 | @property |
| 136 | def bucket(self): |
nothing calls this directly
no outgoing calls
no test coverage detected