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