(self)
| 150 | self._dec_overflow() |
| 151 | |
| 152 | def _do_get(self) -> ConnectionPoolEntry: |
| 153 | use_overflow = self._max_overflow > -1 |
| 154 | |
| 155 | wait = use_overflow and self._overflow >= self._max_overflow |
| 156 | try: |
| 157 | return self._pool.get(wait, self._timeout) |
| 158 | except sqla_queue.Empty: |
| 159 | # don't do things inside of "except Empty", because when we say |
| 160 | # we timed out or can't connect and raise, Python 3 tells |
| 161 | # people the real error is queue.Empty which it isn't. |
| 162 | pass |
| 163 | if use_overflow and self._overflow >= self._max_overflow: |
| 164 | if not wait: |
| 165 | return self._do_get() |
| 166 | else: |
| 167 | raise exc.TimeoutError( |
| 168 | "QueuePool limit of size %d overflow %d reached, " |
| 169 | "connection timed out, timeout %0.2f" |
| 170 | % (self.size(), self.overflow(), self._timeout), |
| 171 | code="3o7r", |
| 172 | ) |
| 173 | |
| 174 | if self._inc_overflow(): |
| 175 | try: |
| 176 | return self._create_connection() |
| 177 | except: |
| 178 | with util.safe_reraise(): |
| 179 | self._dec_overflow() |
| 180 | raise |
| 181 | else: |
| 182 | return self._do_get() |
| 183 | |
| 184 | def _inc_overflow(self) -> bool: |
| 185 | if self._max_overflow == -1: |
nothing calls this directly
no test coverage detected