|
14 | 14 |
|
15 | 15 | from . import compat
|
16 | 16 | from . import connection
|
17 |
| -from . import connect_utils |
18 | 17 | from . import exceptions
|
19 | 18 | from . import protocol
|
20 | 19 |
|
@@ -311,7 +310,6 @@ class Pool:
|
311 | 310 | __slots__ = (
|
312 | 311 | '_queue', '_loop', '_minsize', '_maxsize',
|
313 | 312 | '_init', '_connect_args', '_connect_kwargs',
|
314 |
| - '_working_addr', '_working_config', '_working_params', |
315 | 313 | '_holders', '_initialized', '_initializing', '_closing',
|
316 | 314 | '_closed', '_connection_class', '_record_class', '_generation',
|
317 | 315 | '_setup', '_max_queries', '_max_inactive_connection_lifetime'
|
@@ -377,10 +375,6 @@ def __init__(self, *connect_args,
|
377 | 375 | self._initializing = False
|
378 | 376 | self._queue = None
|
379 | 377 |
|
380 |
| - self._working_addr = None |
381 |
| - self._working_config = None |
382 |
| - self._working_params = None |
383 |
| - |
384 | 378 | self._connection_class = connection_class
|
385 | 379 | self._record_class = record_class
|
386 | 380 |
|
@@ -430,9 +424,8 @@ async def _initialize(self):
|
430 | 424 | # first few connections in the queue, therefore we want to walk
|
431 | 425 | # `self._holders` in reverse.
|
432 | 426 |
|
433 |
| - # Connect the first connection holder in the queue so that it |
434 |
| - # can record `_working_addr` and `_working_opts`, which will |
435 |
| - # speed up successive connection attempts. |
| 427 | + # Connect the first connection holder in the queue so that |
| 428 | + # any connection issues are visible early. |
436 | 429 | first_ch = self._holders[-1] # type: PoolConnectionHolder
|
437 | 430 | await first_ch.connect()
|
438 | 431 |
|
@@ -504,36 +497,15 @@ def set_connect_args(self, dsn=None, **connect_kwargs):
|
504 | 497 |
|
505 | 498 | self._connect_args = [dsn]
|
506 | 499 | self._connect_kwargs = connect_kwargs
|
507 |
| - self._working_addr = None |
508 |
| - self._working_config = None |
509 |
| - self._working_params = None |
510 | 500 |
|
511 | 501 | async def _get_new_connection(self):
|
512 |
| - if self._working_addr is None: |
513 |
| - # First connection attempt on this pool. |
514 |
| - con = await connection.connect( |
515 |
| - *self._connect_args, |
516 |
| - loop=self._loop, |
517 |
| - connection_class=self._connection_class, |
518 |
| - record_class=self._record_class, |
519 |
| - **self._connect_kwargs) |
520 |
| - |
521 |
| - self._working_addr = con._addr |
522 |
| - self._working_config = con._config |
523 |
| - self._working_params = con._params |
524 |
| - |
525 |
| - else: |
526 |
| - # We've connected before and have a resolved address, |
527 |
| - # and parsed options and config. |
528 |
| - con = await connect_utils._connect_addr( |
529 |
| - loop=self._loop, |
530 |
| - addr=self._working_addr, |
531 |
| - timeout=self._working_params.connect_timeout, |
532 |
| - config=self._working_config, |
533 |
| - params=self._working_params, |
534 |
| - connection_class=self._connection_class, |
535 |
| - record_class=self._record_class, |
536 |
| - ) |
| 502 | + con = await connection.connect( |
| 503 | + *self._connect_args, |
| 504 | + loop=self._loop, |
| 505 | + connection_class=self._connection_class, |
| 506 | + record_class=self._record_class, |
| 507 | + **self._connect_kwargs, |
| 508 | + ) |
537 | 509 |
|
538 | 510 | if self._init is not None:
|
539 | 511 | try:
|
|
0 commit comments