Add missing DEL, RPUSH, RPOP and SREM commands to the list of commands to prefix.
Also, this commit refactors the prefixing logic a bit to make it simpler.
* Introduce global key prefix for redis transport
Co-authored-by: Matus Valo <matusvalo@users.noreply.github.com>
* refactor: use a custom redis client
As per the suggestions, refactor the redis key prefixing to use a custom
redis client that prefixes the keys it uses.
The custom client implementation does not prefix every key by default as
the way of prefixing keys may differ for some redis commands, instead it
lists those keys that will be prefixed. In case of commands, where
multiple keys can be passed as an argument, the custom client defines
where the arg positions are starting and ending for the given command.
* test: fix unit tests by moving import statement
* fix: wrap redis.parse_response to remove key prefixes
Co-authored-by: Matus Valo <matusvalo@users.noreply.github.com>
* fix: typo
* fix: lint
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Co-authored-by: Matus Valo <matusvalo@users.noreply.github.com>
Co-authored-by: Jillian Vogel <jill@opencraft.com>
Previously, calling `reject` when `predefined_queues` was not configured would cause `AttributeError` to be raised from `_extract_backoff_policy_configuration_and_message`. That exception could crash the whole Celery worker and force it to exit early because `AttributeError` is not excepted in the nearby call stack.
* enable pre-commit
* use extend-ignore for flake8
* manual flake8 fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update kombu/__init__.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Move pytest.importorskip to run earlier
Currently pytest fails to collect tests when `azure` is not present. Moving the pytest.importorskip clause before `from kombu.transport import azureservicebus` fixes it.
```
==================================== ERRORS ====================================
__________ ERROR collecting t/unit/transport/test_azureservicebus.py ___________
ImportError while importing test module '/build/python-kombu/src/kombu-5.1.0/t/unit/transport/test_azureservicebus.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
t/unit/transport/test_azureservicebus.py:12: in <module>
from kombu.transport import azureservicebus
kombu/transport/azureservicebus.py:66: in <module>
import azure.core.exceptions
E ModuleNotFoundError: No module named 'azure'
```
* Add # noqa to make linter happy
* add accept parameter to SimpleQueue class
* Fixed missing accept for get_nowait() and added unittests
* Remove unused **kwargs from SimpleQueue.__init__
* Use self.consumer.accept instead of new attribute in SimpleQueue
* Add tests for simple interface when accept=[]
Co-authored-by: Matus Valo <matusvalo@gmail.com>
Celery does not coerce configuration values into the right type (See celery/celery#6696).
This is a workaround. This bug will be fixed in Celery NextGen when we will refactor our configuration subsystem.
* Update before installing system dependencies.
* Actually run the linters using tox.
There are no environments named py-flake8, py-pydocstyle and py-apicheck.
* fixed character replace table according to the comment above - dots replaced by dashes, other punctuations replaced by underscores
* optimised with precalculated punctuation set - according to @thedrow suggestion
* queue name tests
* cleanup
* Use a thread-safe implementation of cached_property.
* Restore setter and deleter.
* Restore tests.
* Fix __get__ signature for backport.
* Cleanup.
Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>