romeways-redis-queue 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- romeways_redis_queue-0.1.0/.gitignore +160 -0
- romeways_redis_queue-0.1.0/PKG-INFO +114 -0
- romeways_redis_queue-0.1.0/README.md +97 -0
- romeways_redis_queue-0.1.0/pyproject.toml +32 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/__init__.py +2 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/config/__init__.py +2 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/config/connector/__init__.py +1 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/config/connector/model.py +13 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/config/queue/__init__.py +1 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/config/queue/model.py +12 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/infrastructure/__init__.py +1 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/infrastructure/connector/__init__.py +1 -0
- romeways_redis_queue-0.1.0/romeways_redis_queue/infrastructure/connector/infrastructure.py +38 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit tests / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
.idea/
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: romeways-redis-queue
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Redis / KeyDB list queue connector for romeways
|
|
5
|
+
Project-URL: homepage, https://github.com/CenturyBoys/romeways
|
|
6
|
+
Project-URL: repository, https://github.com/CenturyBoys/romeways
|
|
7
|
+
Author-email: Marco Sievers de Almeida Ximit Gaia <im.ximit@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Python: <4,>=3.11
|
|
15
|
+
Requires-Dist: redis<7,>=5
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Romeways Redis / KeyDB
|
|
19
|
+
|
|
20
|
+
This is an extra package for romeways — for more details access the
|
|
21
|
+
[romeways](https://github.com/CenturyBoys/romeways) Github page.
|
|
22
|
+
|
|
23
|
+
This package uses [redis-py](https://pypi.org/project/redis/) and a **Redis list** as a FIFO
|
|
24
|
+
queue (`RPUSH` to send, `LPOP` to consume). [KeyDB](https://docs.keydb.dev/) is a drop-in Redis
|
|
25
|
+
replacement, so the same connector works against either. Requires a server with `LPOP key count`
|
|
26
|
+
support (Redis >= 6.2, KeyDB).
|
|
27
|
+
|
|
28
|
+
## Configs
|
|
29
|
+
|
|
30
|
+
### Queue
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from dataclasses import dataclass
|
|
34
|
+
|
|
35
|
+
from romeways import GenericQueueConfig
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(slots=True, frozen=True)
|
|
39
|
+
class RedisQueueConfig(GenericQueueConfig):
|
|
40
|
+
"""
|
|
41
|
+
key: str Redis / KeyDB list key used as the queue.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
key: str
|
|
45
|
+
connector_name: str
|
|
46
|
+
frequency: float
|
|
47
|
+
max_chunk_size: int
|
|
48
|
+
sequential: bool
|
|
49
|
+
retries: int
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Connector
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from dataclasses import dataclass
|
|
56
|
+
|
|
57
|
+
from romeways import GenericConnectorConfig
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(slots=True, frozen=True)
|
|
61
|
+
class RedisConnectorConfig(GenericConnectorConfig):
|
|
62
|
+
"""
|
|
63
|
+
url: str Redis / KeyDB connection URL, e.g. "redis://localhost:6379/0".
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
url: str = "redis://localhost:6379/0"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Use case
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import asyncio
|
|
73
|
+
|
|
74
|
+
import romeways
|
|
75
|
+
|
|
76
|
+
# Create a queue config
|
|
77
|
+
config_q = romeways.RedisQueueConfig(
|
|
78
|
+
key="queue.payment.done",
|
|
79
|
+
connector_name="redis-dev1",
|
|
80
|
+
frequency=1,
|
|
81
|
+
max_chunk_size=10,
|
|
82
|
+
sequential=False,
|
|
83
|
+
retries=3,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# Register a controller/consumer for the queue name
|
|
88
|
+
@romeways.queue_consumer(queue_name="queue.payment.done", config=config_q)
|
|
89
|
+
async def controller(message: romeways.Message):
|
|
90
|
+
print(message)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
config_p = romeways.RedisConnectorConfig(
|
|
94
|
+
connector_name="redis-dev1",
|
|
95
|
+
url="redis://localhost:6379/0",
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Register a connector
|
|
99
|
+
romeways.connector_register(
|
|
100
|
+
connector=romeways.RedisQueueConnector, config=config_p, spawn_process=False
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
asyncio.run(romeways.start())
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Semantics
|
|
107
|
+
|
|
108
|
+
- A Redis **list** is the queue: producers `RPUSH` to the right, the consumer `LPOP`s from the
|
|
109
|
+
left — FIFO.
|
|
110
|
+
- `get_messages` pops up to `max_chunk_size` items in one `LPOP key count` call.
|
|
111
|
+
- There are no consumer groups / acks (that would be Redis Streams); romeways' own
|
|
112
|
+
resend-on-error (`ResendException`) re-pushes the message to the same list, honouring the
|
|
113
|
+
queue's `retries`.
|
|
114
|
+
- Use `spawn_process=False`: the Redis connection is created in `on_start` on the running loop.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Romeways Redis / KeyDB
|
|
2
|
+
|
|
3
|
+
This is an extra package for romeways — for more details access the
|
|
4
|
+
[romeways](https://github.com/CenturyBoys/romeways) Github page.
|
|
5
|
+
|
|
6
|
+
This package uses [redis-py](https://pypi.org/project/redis/) and a **Redis list** as a FIFO
|
|
7
|
+
queue (`RPUSH` to send, `LPOP` to consume). [KeyDB](https://docs.keydb.dev/) is a drop-in Redis
|
|
8
|
+
replacement, so the same connector works against either. Requires a server with `LPOP key count`
|
|
9
|
+
support (Redis >= 6.2, KeyDB).
|
|
10
|
+
|
|
11
|
+
## Configs
|
|
12
|
+
|
|
13
|
+
### Queue
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from dataclasses import dataclass
|
|
17
|
+
|
|
18
|
+
from romeways import GenericQueueConfig
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(slots=True, frozen=True)
|
|
22
|
+
class RedisQueueConfig(GenericQueueConfig):
|
|
23
|
+
"""
|
|
24
|
+
key: str Redis / KeyDB list key used as the queue.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
key: str
|
|
28
|
+
connector_name: str
|
|
29
|
+
frequency: float
|
|
30
|
+
max_chunk_size: int
|
|
31
|
+
sequential: bool
|
|
32
|
+
retries: int
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Connector
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from dataclasses import dataclass
|
|
39
|
+
|
|
40
|
+
from romeways import GenericConnectorConfig
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(slots=True, frozen=True)
|
|
44
|
+
class RedisConnectorConfig(GenericConnectorConfig):
|
|
45
|
+
"""
|
|
46
|
+
url: str Redis / KeyDB connection URL, e.g. "redis://localhost:6379/0".
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
url: str = "redis://localhost:6379/0"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Use case
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
|
|
57
|
+
import romeways
|
|
58
|
+
|
|
59
|
+
# Create a queue config
|
|
60
|
+
config_q = romeways.RedisQueueConfig(
|
|
61
|
+
key="queue.payment.done",
|
|
62
|
+
connector_name="redis-dev1",
|
|
63
|
+
frequency=1,
|
|
64
|
+
max_chunk_size=10,
|
|
65
|
+
sequential=False,
|
|
66
|
+
retries=3,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# Register a controller/consumer for the queue name
|
|
71
|
+
@romeways.queue_consumer(queue_name="queue.payment.done", config=config_q)
|
|
72
|
+
async def controller(message: romeways.Message):
|
|
73
|
+
print(message)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
config_p = romeways.RedisConnectorConfig(
|
|
77
|
+
connector_name="redis-dev1",
|
|
78
|
+
url="redis://localhost:6379/0",
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Register a connector
|
|
82
|
+
romeways.connector_register(
|
|
83
|
+
connector=romeways.RedisQueueConnector, config=config_p, spawn_process=False
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
asyncio.run(romeways.start())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Semantics
|
|
90
|
+
|
|
91
|
+
- A Redis **list** is the queue: producers `RPUSH` to the right, the consumer `LPOP`s from the
|
|
92
|
+
left — FIFO.
|
|
93
|
+
- `get_messages` pops up to `max_chunk_size` items in one `LPOP key count` call.
|
|
94
|
+
- There are no consumer groups / acks (that would be Redis Streams); romeways' own
|
|
95
|
+
resend-on-error (`ResendException`) re-pushes the message to the same list, honouring the
|
|
96
|
+
queue's `retries`.
|
|
97
|
+
- Use `spawn_process=False`: the Redis connection is created in `on_start` on the running loop.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "romeways-redis-queue"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Redis / KeyDB list queue connector for romeways"
|
|
5
|
+
authors = [{ name = "Marco Sievers de Almeida Ximit Gaia", email = "im.ximit@gmail.com" }]
|
|
6
|
+
requires-python = ">=3.11,<4"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Programming Language :: Python :: 3.11",
|
|
12
|
+
"Programming Language :: Python :: 3.12",
|
|
13
|
+
"Programming Language :: Python :: 3.13",
|
|
14
|
+
"Programming Language :: Python :: 3.14",
|
|
15
|
+
]
|
|
16
|
+
# `rome-ways` is intentionally NOT declared (installed via `rome-ways[redis]`,
|
|
17
|
+
# so the core is always present) to avoid a circular dependency.
|
|
18
|
+
dependencies = ["redis>=5,<7"]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
homepage = "https://github.com/CenturyBoys/romeways"
|
|
22
|
+
repository = "https://github.com/CenturyBoys/romeways"
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["hatchling"]
|
|
26
|
+
build-backend = "hatchling.build"
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.wheel]
|
|
29
|
+
packages = ["romeways_redis_queue"]
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.sdist]
|
|
32
|
+
include = ["romeways_redis_queue"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .model import RedisConnectorConfig
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from romeways import GenericConnectorConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(slots=True, frozen=True)
|
|
7
|
+
class RedisConnectorConfig(GenericConnectorConfig):
|
|
8
|
+
"""
|
|
9
|
+
url: str Redis / KeyDB connection URL, e.g. "redis://localhost:6379/0".
|
|
10
|
+
See redis.asyncio.from_url -> https://redis.readthedocs.io/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
url: str = "redis://localhost:6379/0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .model import RedisQueueConfig
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from romeways import GenericQueueConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(slots=True, frozen=True)
|
|
7
|
+
class RedisQueueConfig(GenericQueueConfig):
|
|
8
|
+
"""
|
|
9
|
+
key: str Redis / KeyDB list key used as the queue (RPUSH to send, LPOP to consume).
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
key: str
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .connector import RedisQueueConnector
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .infrastructure import RedisQueueConnector
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from redis.asyncio import Redis, from_url
|
|
4
|
+
|
|
5
|
+
from romeways import AQueueConnector
|
|
6
|
+
|
|
7
|
+
from romeways_redis_queue.config import RedisConnectorConfig, RedisQueueConfig
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger("romeways")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RedisQueueConnector(AQueueConnector):
|
|
13
|
+
"""romeways connector backed by a Redis / KeyDB list (FIFO).
|
|
14
|
+
|
|
15
|
+
Messages are ``RPUSH``ed to the list and ``LPOP``ped in batches. KeyDB is a
|
|
16
|
+
drop-in Redis replacement, so this works against either. romeways' own
|
|
17
|
+
resend-on-error (``ResendException``) re-pushes the message to the same list.
|
|
18
|
+
|
|
19
|
+
Requires a server with ``LPOP key count`` support (Redis >= 6.2, KeyDB).
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
_connector_config: RedisConnectorConfig
|
|
23
|
+
_config: RedisQueueConfig
|
|
24
|
+
|
|
25
|
+
async def on_start(self):
|
|
26
|
+
self._redis: Redis = from_url(self._connector_config.url)
|
|
27
|
+
|
|
28
|
+
async def get_messages(self, max_chunk_size: int) -> list[bytes]:
|
|
29
|
+
items = await self._redis.lpop(self._config.key, abs(max_chunk_size))
|
|
30
|
+
if not items:
|
|
31
|
+
return []
|
|
32
|
+
# With a count, LPOP returns a list; guard the single-value form just in case.
|
|
33
|
+
if isinstance(items, (bytes, bytearray, str)):
|
|
34
|
+
return [items if isinstance(items, bytes) else bytes(items)]
|
|
35
|
+
return list(items)
|
|
36
|
+
|
|
37
|
+
async def send_messages(self, message: bytes):
|
|
38
|
+
await self._redis.rpush(self._config.key, message)
|