Skip to content

Commit 352c4c8

Browse files
authored
Switch back to using select.select by default (#141)
* Switch to using select by default * Updated readme * Fixed PEP8 warning * Fixed issue caught in code review
1 parent 3b25cd5 commit 352c4c8

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
Version 2.11.1
5+
--------------
6+
- Switch back to using select.select by default [#140].
7+
48
Version 2.11.0
59
--------------
610
- Added Python 3.13 support.

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ AMQPStorm is a library designed to be consistent, stable and thread-safe.
1515
Changelog
1616
=========
1717

18+
Version 2.11.1
19+
--------------
20+
- Switch back to using select.select by default [#140].
21+
1822
Version 2.11.0
1923
--------------
2024
- Added Python 3.13 support.

amqpstorm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""AMQPStorm."""
2-
__version__ = '2.11.0' # noqa
2+
__version__ = '2.11.1' # noqa
33
__author__ = 'eandersson' # noqa
44

55
import logging

amqpstorm/compatibility.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Python 2/3 Compatibility layer."""
22

3-
import select
43
import sys
54

65
try:
@@ -40,14 +39,6 @@ class DummyException(Exception):
4039
"""
4140

4241

43-
def get_default_poller():
44-
if hasattr(select, 'poll'):
45-
return 'poll'
46-
return 'select'
47-
48-
49-
DEFAULT_POLLER = get_default_poller()
50-
5142
SSL_CERT_MAP = {}
5243
SSL_VERSIONS = {}
5344
SSL_OPTIONS = [

amqpstorm/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Connection(Stateful):
6363
:param bool ssl: Enable SSL
6464
:param dict ssl_options: SSL kwargs
6565
:param dict client_properties: None or dict of client properties
66-
:param str poller: select or poll
66+
:param str poller: Either "select" or "poll". If you encounter file descriptor errors, consider switching to "poll".
6767
:param bool lazy: Lazy initialize the connection
6868
6969
:raises AMQPConnectionError: Raises if the connection
@@ -87,7 +87,7 @@ def __init__(self, hostname, username, password, port=5672, **kwargs):
8787
'ssl': kwargs.get('ssl', False),
8888
'ssl_options': kwargs.get('ssl_options', {}),
8989
'client_properties': kwargs.get('client_properties', {}),
90-
'poller': kwargs.get('poller', compatibility.DEFAULT_POLLER),
90+
'poller': kwargs.get('poller', 'select'),
9191
}
9292
self._validate_parameters()
9393
self._io = IO(self.parameters, exceptions=self._exceptions,

amqpstorm/uri_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _parse_uri_options(self, parsed_uri, use_ssl=False, ssl_options=None):
8585
'heartbeat': int(kwargs.pop('heartbeat',
8686
[DEFAULT_HEARTBEAT_TIMEOUT])[0]),
8787
'poller': kwargs.pop('poller',
88-
[compatibility.DEFAULT_POLLER])[0],
88+
['select'])[0],
8989
'timeout': int(kwargs.pop('timeout',
9090
[DEFAULT_SOCKET_TIMEOUT])[0])
9191
}

0 commit comments

Comments
 (0)