Skip to content

Commit b488bbc

Browse files
authored
Merge pull request #764 from LincolnPuzey/replace-strictredis
Replace StrictRedis with Redis and bump redis version to >=4
2 parents a4875b1 + 80287c0 commit b488bbc

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ of those changes to CLEARTYPE SRL.
1414
| [@jssuzanne](https://github.com/jssuzanne) | Jean-Sébastien Suzanne |
1515
| [@chen2aaron](https://github.com/chen2aaron) | xixijun |
1616
| [@aequitas](https://github.com/aequitas) | Johan Bloemberg |
17+
| [@udogri](https://github.com/udogri) | Udogri Oruaro |
1718
| [@najamansari](https://github.com/najamansari) | Najam Ahmed Ansari |
1819
| [@rpkilby](https://github.com/rpkilby) | Ryan P Kilby |
1920
| [@2miksyn](https://github.com/2miksyn) | Mikhail Smirnov |

dramatiq/brokers/redis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ def __init__(
120120
self.heartbeat_timeout = heartbeat_timeout
121121
self.dead_message_ttl = dead_message_ttl
122122
self.queues = set()
123-
# TODO: Replace usages of StrictRedis (redis-py 2.x) with Redis in Dramatiq 2.0.
124-
self.client = client or redis.StrictRedis(**parameters)
123+
self.client = client or redis.Redis(**parameters)
125124
self.scripts = {name: self.client.register_script(script) for name, script in _scripts.items()}
126125

127126
@property

dramatiq/rate_limits/backends/redis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def __init__(self, *, client=None, url=None, **parameters):
4040
if url is not None:
4141
parameters["connection_pool"] = redis.ConnectionPool.from_url(url)
4242

43-
# TODO: Replace usages of StrictRedis (redis-py 2.x) with Redis in Dramatiq 2.0.
44-
self.client = client or redis.StrictRedis(**parameters)
43+
self.client = client or redis.Redis(**parameters)
4544

4645
def add(self, key, value, ttl):
4746
return bool(self.client.set(key, value, px=ttl, nx=True))

dramatiq/results/backends/redis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def __init__(self, *, namespace="dramatiq-results", encoder=None, client=None, u
4646
if url:
4747
parameters["connection_pool"] = redis.ConnectionPool.from_url(url)
4848

49-
# TODO: Replace usages of StrictRedis (redis-py 2.x) with Redis in Dramatiq 2.0.
50-
self.client = client or redis.StrictRedis(**parameters)
49+
self.client = client or redis.Redis(**parameters)
5150

5251
def get_result(self, message, *, block=False, timeout=None):
5352
"""Get a result from the backend.

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
from __future__ import annotations
19+
1820
import os
1921

2022
from setuptools import setup
@@ -53,7 +55,7 @@ def rel(*xs):
5355
"pika>=1.0,<2.0",
5456
],
5557
"redis": [
56-
"redis>=2.0,<7.0",
58+
"redis>=4.0,<7.0",
5759
],
5860
"watch": [
5961
"watchdog>=4.0",

0 commit comments

Comments
 (0)