Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Redis update 2021-10-08 #1156

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
d37bb21
Add andymccurdy/redis-py@cb97b9bdd47bf5a92f4efa88e52591344a08b98e
Andrew-Chen-Wang Oct 4, 2021
68a7de7
Add andymccurdy/redis-py@9ce7bb2858065c0dc5ac91287b8716def9919291
Andrew-Chen-Wang Oct 4, 2021
a389184
Add andymccurdy/redis-py@3c244af9e7c820d38135562d9385753f5bbb60e6
Andrew-Chen-Wang Oct 4, 2021
b7ede71
Add andymccurdy/redis-py@ad4779eb8200e47a7786f78ca915a246038602c3
Andrew-Chen-Wang Oct 4, 2021
e41b41c
Add andymccurdy/redis-py@627db540acd1f1f36db88290d74cbcd75f6bda0c
Andrew-Chen-Wang Oct 4, 2021
0c3d2ba
Add andymccurdy/redis-py@57cf7ffc1fbaca2f17d03de38ee19e8af48ac153
Andrew-Chen-Wang Oct 4, 2021
1829beb
Add andymccurdy/redis-py@88e5bd8938006a6e7bcc626048a9cd4572bbac68
Andrew-Chen-Wang Oct 4, 2021
d1bed29
Add andymccurdy/redis-py@b021f5a15e61ac4217b533443eba0a1c56c03ef3
Andrew-Chen-Wang Oct 4, 2021
5cb5a3b
Add andymccurdy/redis-py@01b96db203a651ff82598ad66685e487b74b8aac
Andrew-Chen-Wang Oct 4, 2021
0baf344
Add andymccurdy/redis-py@e7064450791b1cb20e1ff94f03385b2d02bb9ec7
Andrew-Chen-Wang Oct 4, 2021
f10467f
Add andymccurdy/redis-py@c7ecb1d4aa68820e000f88c23f6ff3afd4166b8a
Andrew-Chen-Wang Oct 4, 2021
10f2435
Add andymccurdy/redis-py@53fe4d3eae75cabfb635eae5ae9197efa0bf86c3
Andrew-Chen-Wang Oct 5, 2021
eb6c66d
Add andymccurdy/redis-py@fc69bd65494d7ac8d08e16ff38e06936ab6dcc02
Andrew-Chen-Wang Oct 5, 2021
d323846
Add andymccurdy/redis-py@be26730e8136e6a27f397491d44fa723449023db
Andrew-Chen-Wang Oct 5, 2021
dde66f3
Add andymccurdy/redis-py@e9c2e4574a06f240dc528d5ac20cdbeb5eb6564d
Andrew-Chen-Wang Oct 5, 2021
57a21bb
Add andymccurdy/redis-py@6f4ee2dee63171afa4c59742a3726594894916ae
Andrew-Chen-Wang Oct 5, 2021
82e74e6
Add andymccurdy/redis-py@3c0e1163c7afcc42fdcbbf22dd61ac869a6857ee
Andrew-Chen-Wang Oct 5, 2021
2773c34
Add andymccurdy/redis-py@ec89d30815f0ac69ef8c59630fe3cf8314a3782d
Andrew-Chen-Wang Oct 5, 2021
293d90f
Add andymccurdy/redis-py@5240d60ff0636e7baaec2499c1c9018507578bf5
Andrew-Chen-Wang Oct 5, 2021
961da8c
Add andymccurdy/redis-py@238f69e36e0ff5ac9b892706e3a5478b138069cd
Andrew-Chen-Wang Oct 5, 2021
af9f1c7
Add andymccurdy/redis-py@9c60670deea5c593e20204bbd5f172ccfcd1d9db
Andrew-Chen-Wang Oct 5, 2021
335fad9
Add andymccurdy/redis-py@ba30d027a9a55a2ffd44dc8ca01d526b8705ab03
Andrew-Chen-Wang Oct 5, 2021
c5e63df
Add andymccurdy/redis-py@8c4fc802ed03cbebeb15686755e792bc179750e7
Andrew-Chen-Wang Oct 5, 2021
86473fd
Add andymccurdy/redis-py@2789f08dfb7192f112aa0fc8cec6738dfb1b3a08
Andrew-Chen-Wang Oct 5, 2021
05eef1f
Add andymccurdy/redis-py@37e7c093cbeaf7133d5dd7189563d5c15da8d12b
Andrew-Chen-Wang Oct 5, 2021
30e2082
Add andymccurdy/redis-py@e498182b8e208911ea2454838109fb1249b83c5c
Andrew-Chen-Wang Oct 5, 2021
3bef54d
Add andymccurdy/redis-py@161774be431f2de3c44037698ac311735d559636
Andrew-Chen-Wang Oct 5, 2021
b6c8416
Add andymccurdy/redis-py@8c82e429224e0fb7f1739f741e63f23126e3c088
Andrew-Chen-Wang Oct 5, 2021
94e2b06
Add andymccurdy/redis-py@8ea26c4f5c82a3fde5dd2fb209d0c8644714626d
Andrew-Chen-Wang Oct 8, 2021
d11ecd9
Add andymccurdy/redis-py@8ea26c4f5c82a3fde5dd2fb209d0c8644714626d
Andrew-Chen-Wang Oct 8, 2021
a83c83e
Add andymccurdy/redis-py@8ea26c4f5c82a3fde5dd2fb209d0c8644714626d
Andrew-Chen-Wang Oct 8, 2021
3ba0232
Add andymccurdy/redis-py@295b547fb0fe67cef7c21f84f98bbfad4ca80d08
Andrew-Chen-Wang Oct 8, 2021
80be5a6
Add andymccurdy/redis-py@5964d700beb9a6b195d64430b0a655e6aa6fd721
Andrew-Chen-Wang Oct 8, 2021
6a37676
Add andymccurdy/redis-py@9f82778b78b2e4fd1482255edc91d10c4dda2988
Andrew-Chen-Wang Oct 8, 2021
138ae76
Add andymccurdy/redis-py@41e3f56f65b690ae39ab798a85b42e44ee72a829
Andrew-Chen-Wang Oct 8, 2021
760868e
Add andymccurdy/redis-py@efdba1a77a2755c70ba9754aa592dde8c8c50217
Andrew-Chen-Wang Oct 8, 2021
6cc5b45
Add andymccurdy/redis-py@de9922ad0fc955668d99748f3ad3be0ccff1f9da
Andrew-Chen-Wang Oct 8, 2021
5fa58b7
Add andymccurdy/redis-py@18c1cc7482d2177809d381e91721f119117849ff
Andrew-Chen-Wang Oct 8, 2021
a7a8c21
Add andymccurdy/redis-py@9f64c56e0f6994df0609a803e613a055ee57a7cd
Andrew-Chen-Wang Oct 8, 2021
e28e889
Add andymccurdy/redis-py@9f64c56e0f6994df0609a803e613a055ee57a7cd
Andrew-Chen-Wang Oct 8, 2021
06c70cd
Add andymccurdy/redis-py@3dc2bf906f634383d33952d36cd78156a6e36e0e
Andrew-Chen-Wang Oct 8, 2021
4d46a4b
Add andymccurdy/redis-py@e53227cf68c065b4d31f39cdde7c85c5e91dd1bf
Andrew-Chen-Wang Oct 8, 2021
dd35c94
Add andymccurdy/redis-py@0f8d0dcbb3a7f759843f3f89e413f9333d027c98
Andrew-Chen-Wang Oct 8, 2021
8fd5041
Add andymccurdy/redis-py@51516cbd16b538584b7ea8c6a0cdbc76cda3d90a
Andrew-Chen-Wang Oct 8, 2021
0d99aec
Add andymccurdy/redis-py@da6e3524622c9e9862ac57de60d9f188e106b29d
Andrew-Chen-Wang Oct 8, 2021
c24a727
Add andymccurdy/redis-py@da6e3524622c9e9862ac57de60d9f188e106b29d
Andrew-Chen-Wang Oct 8, 2021
d696d95
Add andymccurdy/redis-py@febede19423c95515a7548cd73aa1a90c639ba1f
Andrew-Chen-Wang Oct 8, 2021
3024fb1
Add andymccurdy/redis-py@42a050c6c0d120104c7433e825e7a798ba411e55
Andrew-Chen-Wang Oct 8, 2021
d178e66
Add andymccurdy/redis-py@42a050c6c0d120104c7433e825e7a798ba411e55
Andrew-Chen-Wang Oct 8, 2021
efc1a24
Add andymccurdy/redis-py@cf3973237205d4bcd74d7cf22889ff10aac35539
Andrew-Chen-Wang Oct 8, 2021
e64ae81
Add andymccurdy/redis-py@53658c4f865c4f2e1f6810c6ce4e9b31a9dd7eaa
Andrew-Chen-Wang Oct 8, 2021
a5bb394
Add andymccurdy/redis-py@bfc4cd92c8070de9bfa7736ef21b44eb6fe35ed9
Andrew-Chen-Wang Oct 8, 2021
28afe1c
Add andymccurdy/redis-py@6c70fcdd10cca7de15175a77824009babfac4417
Andrew-Chen-Wang Oct 8, 2021
42cf80d
Add andymccurdy/redis-py@9527ae88538735c10def3716cdae9388cdee2388
Andrew-Chen-Wang Oct 8, 2021
b458449
Lint
Andrew-Chen-Wang Oct 8, 2021
e145af0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2021
7ff067d
Add CHANGES fragment
Andrew-Chen-Wang Oct 8, 2021
4e40626
Fix type annotation error
Andrew-Chen-Wang Oct 8, 2021
1749adb
Add missing async keyword
Andrew-Chen-Wang Oct 8, 2021
5929b90
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2021
da907d1
Add missing async keywords
Andrew-Chen-Wang Oct 8, 2021
d42ddc6
Fix tests
Andrew-Chen-Wang Oct 8, 2021
5217680
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2021
a867a34
Patch missed changes in commands.py
seandstewart Nov 4, 2021
7744a83
Patch port for Sentinel.execute_command() to be async
seandstewart Nov 4, 2021
3b61170
Fix most broken tests (add in awaits, etc).
seandstewart Nov 4, 2021
4c54b8a
Merge branch 'master' into redis-update
seandstewart Nov 4, 2021
c3fa5dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 4, 2021
a767650
Allow mypy to fail in CI
seandstewart Nov 5, 2021
e3a784c
Appease the linter and fix a bunch of imports.
seandstewart Nov 5, 2021
5ac2d8d
Drop support for py3.6 and only test on 6.2 (same redis version as re…
seandstewart Nov 5, 2021
b7dc6bd
Bump version to 3.0
seandstewart Nov 5, 2021
af6046e
Bump pypy versions in CI
seandstewart Nov 5, 2021
6fd33b0
Fix matrix exclusions
seandstewart Nov 5, 2021
59e0eb4
Fix remaining tests.
seandstewart Nov 20, 2021
e9bb720
Fast-forward core to redis/redis-py@4e9cc015
seandstewart Nov 21, 2021
cc87168
Add docker-compose.yml which includes redis-modules container.
seandstewart Nov 21, 2021
4db8d20
Drop large-file check.
seandstewart Nov 21, 2021
4b2fcca
Fast-forward tests to redis/redis-py@4e9cc015
seandstewart Nov 21, 2021
c8f2074
Update CI to include redismodules deployment.
seandstewart Nov 21, 2021
0d7d1f5
Fix search port.
seandstewart Nov 22, 2021
18ea639
Add custom marker
seandstewart Nov 22, 2021
4c97fd7
Merge branch 'master' into redis-update
Andrew-Chen-Wang Jan 3, 2022
817e9b0
Update test_json tests and revert some of my changes
Andrew-Chen-Wang Jan 3, 2022
505878a
await fail in call_with_retry
Andrew-Chen-Wang Jan 12, 2022
61612b1
Update test_retry.py
Andrew-Chen-Wang Jan 12, 2022
cb93ef4
Hotfix add redis/redis-py#1832
Andrew-Chen-Wang Jan 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
run: |
pip install -r tests/requirements-mypy.txt
mypy
continue-on-error: true
- name: Run linter
run: |
make lint
Expand All @@ -60,14 +61,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
pyver: ["3.6", "3.7", "3.8", "3.9", "3.10", pypy3]
pyver: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
uvloop: [uvloop, no-uvloop]
redis: [5.0.10, 6.2.4]
redis: [6.2.4]
exclude:
- { pyver: pypy3, uvloop: uvloop, os: ubuntu-latest, redis: 5.0.10 }
- { pyver: pypy3, uvloop: uvloop, os: ubuntu-latest, redis: 6.2.4 }
- { pyver: 3.6, uvloop: uvloop, os: ubuntu-latest, redis: 5.0.10 }
- { pyver: 3.6, uvloop: uvloop, os: ubuntu-latest, redis: 6.2.4 }
- { pyver: pypy-3.7, uvloop: uvloop, os: ubuntu-latest, redis: 6.2.4 }
- { pyver: pypy-3.8, uvloop: uvloop, os: ubuntu-latest, redis: 6.2.4 }
fail-fast: false
services:
redis:
Expand All @@ -81,6 +80,15 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
redismod:
image: redislabs/redismod:edge
ports:
- 36379:6379/tcp
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ${{ matrix.os }}
timeout-minutes: 15
env:
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ repos:
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
- id: check-symlinks
- id: debug-statements
- id: detect-aws-credentials
Expand Down
1 change: 1 addition & 0 deletions CHANGES/1156.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updates aioredis to redis at commit andymccurdy/redis-py@9419f1d
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Stanislau Arkhipenka
Taku Fukada
Taras Voinarovskyi
Thanos Lefteris
Theron Luhn <luhn>
Thomas Steinacher
Volodymyr Hotsyk
Youngmin Koo <youngminz>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ based on asyncio.
| ACL support | :white_check_mark: |
| Streams support | :white_check_mark: |
| Redis Cluster support | :no_entry_sign: |
| Tested Python versions | 3.6, 3.7, 3.8, 3.9, 3.10 |
| Tested Python versions | 3.7, 3.8, 3.9, 3.10 |
| Tested for Redis servers | 5.0, 6.0 |
| Support for dev Redis server | through low-level API |

Expand All @@ -37,7 +37,7 @@ Recommended with hiredis for performance and stability reasons:

## Requirements

- Python 3.6+
- Python 3.7+
- hiredis (Optional but recommended)
- async-timeout
- typing-extensions
Expand Down
2 changes: 1 addition & 1 deletion aioredis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def int_or_str(value):
return value


__version__ = "2.0.1"
__version__ = "2.1.0"
VERSION = tuple(map(int_or_str, __version__.split(".")))

__all__ = [
Expand Down
105 changes: 105 additions & 0 deletions aioredis/backoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import random
from abc import ABC, abstractmethod


class AbstractBackoff(ABC):
"""Backoff interface"""

def reset(self):
"""
Reset internal state before an operation.
`reset` is called once at the beginning of
every call to `Retry.call_with_retry`
"""
pass

@abstractmethod
def compute(self, failures: int):
"""Compute backoff in seconds upon failure"""
pass


class ConstantBackoff(AbstractBackoff):
"""Constant backoff upon failure"""

def __init__(self, backoff: float):
"""`backoff`: backoff time in seconds"""
self._backoff = backoff

def compute(self, failures: int):
return self._backoff


class NoBackoff(ConstantBackoff):
"""No backoff upon failure"""

def __init__(self):
super().__init__(0)


class ExponentialBackoff(AbstractBackoff):
"""Exponential backoff upon failure"""

def __init__(self, cap: float, base: float):
"""
`cap`: maximum backoff time in seconds
`base`: base backoff time in seconds
"""
self._cap = cap
self._base = base

def compute(self, failures: int):
return min(self._cap, self._base * 2 ** failures)


class FullJitterBackoff(AbstractBackoff):
"""Full jitter backoff upon failure"""

def __init__(self, cap: float, base: float):
"""
`cap`: maximum backoff time in seconds
`base`: base backoff time in seconds
"""
self._cap = cap
self._base = base

def compute(self, failures: int):
return random.uniform(0, min(self._cap, self._base * 2 ** failures))


class EqualJitterBackoff(AbstractBackoff):
"""Equal jitter backoff upon failure"""

def __init__(self, cap: float, base: float):
"""
`cap`: maximum backoff time in seconds
`base`: base backoff time in seconds
"""
self._cap = cap
self._base = base

def compute(self, failures):
temp = min(self._cap, self._base * 2 ** failures) / 2
return temp + random.uniform(0, temp)


class DecorrelatedJitterBackoff(AbstractBackoff):
"""Decorrelated jitter backoff upon failure"""

def __init__(self, cap: float, base: float):
"""
`cap`: maximum backoff time in seconds
`base`: base backoff time in seconds
"""
self._cap = cap
self._base = base
self._previous_backoff = 0

def reset(self):
self._previous_backoff = 0

def compute(self, failures: int):
max_backoff = max(self._base, self._previous_backoff * 3)
temp = random.uniform(self._base, max_backoff)
self._previous_backoff = min(self._cap, temp)
return self._previous_backoff