Tags: brainix/pottery
Tags
In Redlock, consistently measure time in seconds (#627) * In Redlock, consistently measure time in seconds Prior to this PR: 1. `timeout` was in seconds 2. `.locked()` returned milliseconds 3. `auto_release_time` was in milliseconds 4. `RETRY_DELAY` was in milliseconds As of this PR: 1. `timeout` is in seconds 2. `.locked()` returns seconds 3. `auto_release_time` is in seconds 4. `_RETRY_DELAY` is in seconds * Upgrade requirements
Dramatically speed up CachedOrderedDict.__init__() (#625) * Dramatically speed up CachedOrderedDict.__init__() Previously, we were making multiple round trips to Redis, one per `dict_key`. Now, we make a single bulk call to Redis. * Fix type annotations for Python < 3.10 * Bump version number * Preserve the Open-Closed Principle with name mangling 1. https://youtu.be/miGolgp9xq8?t=2086 2. https://stackoverflow.com/a/38534939
Properly configure logging for the Pottery library (#591) * Properly configure logging for the Pottery library References: 1. https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library 2. https://github.com/elastic/elasticsearch-py/blob/013433e5008277144065ad8e82f66870b203269a/elasticsearch/__init__.py#L43 * Bump version number
Don't allow a RedisDeque to equal a RedisList... (#576) * Make RedisList.__eq__() more clear * Make RedisList.__eq__() more clear * Don't allow a RedisDeque to equal a RedisList... ...even if they're both on the same Redis instance and have the same key. Before this PR: ```python >>> from pottery import RedisDeque, RedisList >>> RedisDeque(key='videos:dicts') == RedisList(key='videos:dicts') True ``` As of this PR: ```python >>> from pottery import RedisDeque, RedisList >>> RedisDeque(key='videos:dicts') == RedisList(key='videos:dicts') False ``` * Reorder logic in RedisList.__eq__() * Bump version number * Unit test RedisList equality with RedisDeque * Unit test RedisDeque equality with RedisList * Name unit tests more accurately
Don't allow RedisDeques to equal Python lists... (#574) * Don't allow RedisDeques to equal Python lists... ...even if they contain the same elements. ```python >>> import collections >>> collections.deque([1, 2, 3]) == [1, 2, 3] False ``` * Bump version number
Dramatically simplify RedisList.__eq__() (#573) * Dramatically simplify RedisList.__eq__() This makes the code easier to reason about, and prevents potential bugs. * Warn when doing expensive equality comparisons * Bump version number * Make RedisList.__eq__() more performant * Don't allow RedisDeques to equal RedisLists... ...even if they contain the same elements. ```python >>> import collections >>> collections.deque([1, 2, 3]) == [1, 2, 3] False ```
Properly compare RedisLists on different Redis dbs (#572) * Properly compare RedisLists on different Redis dbs Before this PR, `list1 == list2` would fail if both were `RedisList`s but on different Redis databases. This is because we'd try to reuse the same Redis pipeline for both lists. * Don't coverage test unusual code branches * Bump version number
Robustly test if Redis clients talk to the same db (#560) * Robustly test if Redis clients talk to the same db Previously, we were comparing the two clients' `connection_kwargs`, but `connection_kwargs` contains more than just `host`, `port`, and `db`: ```python >>> from redis import Redis >>> redis = Redis() >>> redis.connection_pool.connection_kwargs {'db': 0, 'username': None, 'password': None, 'socket_timeout': None, 'encoding': 'utf-8', 'encoding_errors': 'strict', 'decode_responses': False, 'retry_on_error': [], 'retry': None, 'health_check_interval': 0, 'client_name': None, 'redis_connect_func': None, 'host': 'localhost', 'port': 6379, 'socket_connect_timeout': None, 'socket_keepalive': None, 'socket_keepalive_options': None} ``` This PR allows Pottery to recognize that two Redis clients are connected to the same database even if their socket timeout our retry policies are different. * Bump version number
Design RedisSimpleQueue class (#553) * Design RedisSimpleQueue class This class is complete with the exception of the `.put()` and `.get()` methods. `RedisSimpleQueue` will be powered by Redis streams, and the `.put()` and `.get()` methods will be implemented using `XADD` and `XREAD`/`XDEL`. https://redis.io/topics/streams-intro * Flesh out .put() and .get() methods * Make note of potential bug in redis-py * Unit test RedisSimpleQueue * Document RedisSimpleQueue * Write docstrings * Bump version number
PreviousNext