summaryrefslogtreecommitdiff
path: root/redis/client.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Stop hiding errors that occur inside __del__ methodsJon Dufresne2020-02-121-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an exception occurs inside the __del__ method, it should be reported to the developer. Not doing so could hide bugs. Python automatically handles exceptions inside __del__ methods, for example: class A: def __del__(self): 1 / 0 A() print("after del") Results in the output: $ python3 ~/blah.py Exception ignored in: <function A.__del__ at 0x7fbbf2bbfc20> Traceback (most recent call last): File "/home/jon/test.py", line 3, in __del__ 1 / 0 ZeroDivisionError: division by zero after del From this example, we can see the bug was not hidden and the code after __del__ still executed. fixes #1281
* Improve Redis.hmset() warning messageJon Dufresne2020-02-121-1/+6
| | | | | | | | | It now describe what is deprecated and displays for the callers line by using stacklevel=2. The warning is now tested and not emitted during normal test runs. Fixes #1282
* Make hset support multiple field/value pairs. (#1271)赖信涛2020-02-071-4/+16
| | | | | | | | | | | | * make `hset` command support multi field/value pairs. see: https://redis.io/commands/hset close https://github.com/andymccurdy/redis-py/issues/1269 deprecated: hmset Co-authored-by: Alan Mai <0110amai@gmail.com>
* remove Redis and ConnectionPool __eq__ comparisonAndy McCurdy2020-02-011-6/+0
| | | | | | | | | | | | | After further thought this was a bad idea. Just because two connection pools share the same connection arguments does not make them equal. It would seem quite odd if pool_a == pool_b yet pool_a.disconnect() doesn't close all of pool_b's connections. Ref #1240 Fixes #1277 Fixes #1275 Fixes #1267 Fixes #1273
* Move the username argument in the Redis and Connection classes to the endAndy McCurdy2020-01-311-2/+2
| | | | | | | This helps those poor souls that specify all their connection options as non-keyword arguments. Fixes #1276
* Fix spelling in docstring (#1272)Damon Jablons2020-01-301-1/+1
|
* add type filter to scan functionnetocp2020-01-301-5/+20
| | | | Fixed #1220
* Added the 'ssl_check_hostname' option.Andy McCurdy2019-12-291-0/+2
| | | | | | | | 'ssl_check_hostname' tells SSL Connections to whether to require the TCP hostname to match the hostname specified in the SSL Cert. By default 'ssl_check_hostname' is False to maintain backwards compatibility. Fixed #1196
* Allow setting client_name during connection construction.Peter van Dijk2019-12-291-1/+2
| | | | | | Client instances and Connection pools now accept "client_name" as an optional argument. If supplied, all connections created will be named via CLIENT SETNAME once the connection to the server is established.
* 'with' statement for PubSub (#765)Dmitry Kuragin2019-12-291-0/+6
| | | PubSub objects are now context managers.
* Testing the boolean nature of Pipeline instance should always return True.Andy McCurdy2019-12-291-0/+8
| | | | | | | | Prior to this, pipeline instances used __len__() which returns the number of queued commands on the pipeline. When there were no queued commands, the pipeline instance would evaluate to 0 or False. Fixes #994
* Added support for ACL commandsAndy McCurdy2019-12-281-4/+245
|
* Fix TypeError by passing optional decode_responses keyword argument d… (#1239)Jakob Keller2019-11-111-2/+5
| | | | * Fix TypeError by passing optional decode_responses keyword argument down to parse_slowlog_get()
* Add equality test on Redis client and conn pool (#1240)Rajiv Bakulesh Shah2019-11-111-0/+6
| | | Add equality test on Redis client and connection pool
* Fix misplaced space (#1237)Thomas Matecki2019-10-271-1/+1
| | | Sorry, I'm a pendant.
* Allow Pipeline.execute() to execute on empty command stack if it is watching ↵Brian Maissy2019-10-241-1/+1
| | | | keys
* version 3.3.8, fix MONITOR output to account for all types of clients3.3.8huangwei-ds52019-08-191-2/+16
| | | | | | | | | | The client section of MONITOR output varies for TCP connections, unix socket connections and commands executed from Lua scripts. Account for each of these cases by including an additional key `client_type` in the MONITOR output. `client_type` will be one of ('tcp', 'unix', 'lua'). `client_address` and `client_port` vary based on the `client_type`. Fixes #1201
* Pipelines shouldn't retry ConnectionErrors implicitlyAndy McCurdy2019-07-281-15/+24
|
* Add an Event parameter to PubSubWorkerThread and run_in_thread so (#1195)Timothy Rule2019-07-281-5/+5
| | | | The PubSubWorkerThread now uses a `threading.Event` to control its life cycle.
* PING/PONG health checksAndy McCurdy2019-07-281-11/+42
| | | | | | | | | | | | | | | | | | | | | | The `Redis` class and the `ConnectionPool` class now support the "health_check_interval=N" option. By default N=0, which turns off health checks. `N` should be an integer, and when greater than 0, ensures that a health check is performed just before command execution anytime the underlying connection has been idle for more than N seconds. A health check is a full PING/PONG round trip to the Redis server. If a health check encounters a ConnectionError or TimeoutError, the connection is disconnected and reconnected and the health check is retried exactly once. Any error during the retry is raised to the caller. Health check retries are not governed by any other options such as `retry_on_timeout`. In systems where idle times are common, these health checks are the intended way to reconnect to the Redis server without harming any user data. When this option is enabled for PubSub connections, calling `get_message()` or `listen()` will send a health check anytime a message has not been read on the PubSub connection for `health_check_interval` seconds. Users should call `get_message()` or `listen()` at least every `health_check_interval` seconds in order to keep the connection open.
* Ability to create a client that uses a single connectionAndy McCurdy2019-07-231-10/+32
| | | | | | | | | | | | | This has multiple uses: * Single connection clients will not be considered threadsafe. This means certain settings could temporarily be adjusted. For example, a context manager could temporarily modify the encoding behavior for a set of commands. * We can introduce more thorough health checks that only happen when a connection is handed out from the connection pool. * Workloads that issue many commands to Redis should be slightly faster. Prior to this change, the client must retrieve a connection from the pool for each command.
* Handle removed claimed messages without an exceptionThomas Daskalakis2019-07-171-1/+7
| | | | Fixes #1191
* Add READONLY and READWRITE commandsTheo Despoudis2019-07-091-2/+10
|
* case insensitive response callbacks.Andy McCurdy2019-05-281-1/+29
| | | | | | | this change allows users to call client.execute_command('info') or client.execute_command('INFO') and get the same parsed result. Fixes #1168
* remove Token class in favor of bytestringremove_tokenAndy McCurdy2019-05-281-79/+81
| | | | | | | The Token class was needed when supporting Python 2.6. Now that we've dropped support for 2.6, we don't need it anymore. Fixes #1066
* add tests for encoding issues and fix bugs foundAndy McCurdy2019-05-261-1/+1
|
* monitor command now has full command text. test suite improvedAndy McCurdy2019-05-261-4/+8
|
* Merge branch 'master' into monitorAndy McCurdy2019-05-261-2/+4
|\
| * Merge pull request #1152 from aachurin/masterAndy McCurdy2019-04-291-2/+4
| |\ | | | | | | Fix for https://github.com/andymccurdy/redis-py/issues/1135
| | * Update client.pyaachurin2019-03-161-2/+4
| | | | | | | | | Fix for https://github.com/andymccurdy/redis-py/issues/1135
* | | Merge branch 'pr/1033' into monitorAndy McCurdy2019-04-251-0/+49
|\ \ \ | |/ / |/| |
| * | Added support for the monitor command.Doug Kisabaka2019-02-251-0/+49
| |/
* | Fix PubSubWorkerThread race conditionAndy McCurdy2019-04-181-13/+8
|/ | | | | | | | | | | | Resolves a race condition found in the PubSubWorkerThread. Prior to this change is was possible to receive the server's resonse to an unsubscribe message prior to the channel/pattern being added to the pending_unsubscribe set. This also improves PubSubWorkerThread.stop so that the run function is stopped immediately after the next iteration. fixes #1150
* Merge pull request #1023 from ycraaron/1022-fix-retry-logicAndy McCurdy2019-01-271-2/+4
|\ | | | | 1022: Fix retry logic for StricRedis and PubSub
| * put not outside of the parenthesesAaron Yang2018-09-021-2/+2
| |
| * fix retry for PubSubAaron Yang2018-08-231-1/+2
| |
| * pep8Aaron Yang2018-08-231-1/+2
| |
| * fix retry logic for StricRedisAaron Yang2018-08-231-1/+1
| |
* | Added a test for #1126Andy McCurdy2019-01-271-2/+2
| |
* | Merge pull request #1126 from guybe7/geohash_fixAndy McCurdy2019-01-271-1/+7
|\ \ | | | | | | GEOHASH response may contain None elements
| * | GEOHASH response may contain None elementsGuy Benoish2019-01-231-1/+7
| | |
* | | Merge branch 'master' into xreadgroup_handle_nil_fieldsAndy McCurdy2019-01-271-1/+4
|\ \ \ | |/ /
| * | Added noack option for XREADGROUPJohn T. Myers2019-01-101-1/+4
| | |
* | | Fix #1116 - trimmed stream causes exception on xreadgroup with id 0Xabier Eizmendi2019-01-101-0/+2
|/ / | | | | | | | | | | messages Signed-off-by: Xabier Eizmendi <xeizmendi@gmail.com>
* | Remove unnecessary compat shim for 'bytes'Jon Dufresne2018-12-281-1/+1
| | | | | | | | | | | | Both Python 2.7 & Python 3 have the types bytes. On Python 2.7, it is an alias for the type str, same as what was previously defined in _compat.py.
* | Encode Stream message names within XREAD and XREADGROUP responses correctlyAndy McCurdy2018-12-271-1/+1
| | | | | | | | Stream message now respect the decode_responses flag.
* | XPENDING range queries no longer allow COUNT to be infiniteAndy McCurdy2018-12-271-7/+4
| | | | | | | | | | | | | | Redis 5.0.1 and beyond require that COUNT be specified as a positive integer. Since we can't guess the maximum possible value (UULONG_MAX can vary based on server architecture), force min/max/count to be required arguments
* | ZADD correctly returns None in certain edge cases when incr=TrueAndy McCurdy2018-12-271-0/+2
| | | | | | | | | | | | | | When incr=True and xx=True and an element is specified that doesn't exist the Redis server returns None. redis-py now does this as well. Fixes #1084
* | Merge pull request #1077 from oranagra/fix_info_parsingAndy McCurdy2018-12-181-2/+6
|\ \ | | | | | | Re-fix the recently broken INFO parsing, see #1018
| * | Re-fix the recently broken INFO parsing, see #1018Oran Agra2018-11-181-2/+6
| | | | | | | | | | | | | | | The value part of the info line may contains : in many cases, most importantly an IPv6 slave address, may cause the parser to crash.