Skip to content

Commit 5e5043a

Browse files
committed
Merge branch 'release/0.4.0'
2 parents 8d15da7 + 189b199 commit 5e5043a

File tree

8 files changed

+320
-461
lines changed

8 files changed

+320
-461
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- 6379:6379
6666
strategy:
6767
matrix:
68-
py_version: ["3.7", "3.8", "3.9", "3.10"]
68+
py_version: ["3.8", "3.9", "3.10", "3.11"]
6969
runs-on: "ubuntu-latest"
7070
steps:
7171
- uses: actions/checkout@v2

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ RedisAsyncResultBackend parameters:
7979
* `keep_results` - flag to not remove results from Redis after reading.
8080
* `result_ex_time` - expire time in seconds (by default - not specified)
8181
* `result_px_time` - expire time in milliseconds (by default - not specified)
82-
> IMPORTANT: **It is highly recommended to use expire time ​​in RedisAsyncResultBackend**
83-
> If you want to add expiration, either `result_ex_time` or `result_px_time` must be set.
82+
> IMPORTANT: **It is highly recommended to use expire time ​​in RedisAsyncResultBackend**
83+
> If you want to add expiration, either `result_ex_time` or `result_px_time` must be set.
8484
>```python
8585
># First variant
8686
>redis_async_result = RedisAsyncResultBackend(
@@ -93,4 +93,4 @@ RedisAsyncResultBackend parameters:
9393
> redis_url="redis://localhost:6379",
9494
> result_px_time=1000000,
9595
>)
96-
>```
96+
>```

poetry.lock

+296-444
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
[tool.poetry]
22
name = "taskiq-redis"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
description = "Redis integration for taskiq"
55
authors = ["taskiq-team <taskiq@norely.com>"]
66
readme = "README.md"
77
classifiers = [
88
"Programming Language :: Python",
99
"Programming Language :: Python :: 3",
1010
"Programming Language :: Python :: 3 :: Only",
11-
"Programming Language :: Python :: 3.7",
1211
"Programming Language :: Python :: 3.8",
1312
"Programming Language :: Python :: 3.9",
1413
"Programming Language :: Python :: 3.10",
14+
"Programming Language :: Python :: 3.11",
1515
]
1616
homepage = "https://github.com/taskiq-python/taskiq-redis"
1717
repository = "https://github.com/taskiq-python/taskiq-redis"
1818
keywords = ["taskiq", "tasks", "distributed", "async", "redis", "result_backend"]
1919

2020
[tool.poetry.dependencies]
21-
python = "^3.7"
21+
python = "^3.8.1"
2222
taskiq = "^0"
2323
redis = "^4.2.0"
2424

2525
[tool.poetry.dev-dependencies]
2626
pytest = "^7.0"
27-
flake8 = "^4.0.1"
27+
flake8 = "^6"
2828
mypy = "^0.961"
2929
isort = "^5.10.1"
3030
yesqa = "^1.3.0"
31-
wemake-python-styleguide = "^0.16.1"
31+
wemake-python-styleguide = "^0.18"
3232
black = "^22.3.0"
3333
autoflake = "^1.4"
3434
pytest-cov = "^3.0.0"

taskiq_redis/exceptions.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
class TaskIQRedisError(Exception):
1+
from taskiq.exceptions import ResultBackendError, ResultGetError, TaskiqError
2+
3+
4+
class TaskIQRedisError(TaskiqError):
25
"""Base error for all taskiq-redis exceptions."""
36

47

5-
class DuplicateExpireTimeSelectedError(TaskIQRedisError):
8+
class DuplicateExpireTimeSelectedError(ResultBackendError, TaskIQRedisError):
69
"""Error if two lifetimes are selected."""
710

811

9-
class ExpireTimeMustBeMoreThanZeroError(TaskIQRedisError):
12+
class ExpireTimeMustBeMoreThanZeroError(ResultBackendError, TaskIQRedisError):
1013
"""Error if two lifetimes are less or equal zero."""
1114

1215

13-
class ResultIsMissingError(TaskIQRedisError):
16+
class ResultIsMissingError(TaskIQRedisError, ResultGetError):
1417
"""Error if there is no result when trying to get it."""

taskiq_redis/redis_backend.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def is_result_ready(self, task_id: str) -> bool:
100100
async with Redis(connection_pool=self.redis_pool) as redis:
101101
return bool(await redis.exists(task_id))
102102

103-
async def get_result( # noqa: WPS210
103+
async def get_result(
104104
self,
105105
task_id: str,
106106
with_logs: bool = False,

tests/test_broker.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import asyncio
22
import uuid
3+
from typing import Union
34

45
import pytest
5-
from taskiq import AsyncBroker, BrokerMessage
6+
from taskiq import AckableMessage, AsyncBroker, BrokerMessage
67

78
from taskiq_redis import ListQueueBroker, PubSubBroker
89

910

10-
async def get_message(broker: AsyncBroker) -> bytes: # type: ignore
11+
async def get_message( # type: ignore
12+
broker: AsyncBroker,
13+
) -> Union[bytes, AckableMessage]:
1114
"""
1215
Get a message from the broker.
1316

tests/test_result_backend.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from taskiq import TaskiqResult
55

66
from taskiq_redis import RedisAsyncResultBackend
7+
from taskiq_redis.exceptions import ResultIsMissingError
78

89

910
@pytest.mark.anyio
@@ -94,7 +95,7 @@ async def test_remove_results_after_reading(redis_url: str) -> None:
9495
)
9596

9697
await result_backend.get_result(task_id=task_id)
97-
with pytest.raises(Exception):
98+
with pytest.raises(ResultIsMissingError):
9899
await result_backend.get_result(task_id=task_id)
99100

100101

0 commit comments

Comments
 (0)