| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
Covers the class redis.utils.dummy.
|
|
|
|
|
|
|
| |
Lock.extend() now has a new option, `replace_ttl`. When False (the
default), Lock.extend() adds the `additional_time` to the lock's existing
TTL. When replace_ttl=True, the lock's existing TTL is replaced with
the value of `additional_time`.
|
|
|
|
| |
replace with a '6.0.0' literal when Redis 6 is GA
|
|
|
|
|
| |
fixes #1304
fixes #1280
|
| |
|
|
|
|
|
|
|
| |
The `EXECABORT` error type was added in Redis 2.6.5 and is returned from an
`EXEC` command to indicate that the transaction was aborted due to an invalid
command. It is not necessary to call `DISCARD` after this error, and doing so
causes a "DISCARD without MULTI" error.
|
|
|
|
| |
fixes #1298
|
|
|
|
| |
Fixes #1268
|
|
|
|
|
|
|
|
|
|
| |
This allows memoryview instances to be passed to Redis command args that
expect strings or bytes. The memoryview instance is sent directly to
the socket such that there are zero copies made of the underlying data
during command packing.
Fixes #1265
Fixes #1285
|
|
|
|
|
|
|
|
|
| |
When waiting to acquire a lock, the Lock object will sleep until
the lock is acquired or until blocking_timeout has elapsed. This optimization
calculates whether the next iteration will occur after blocking_timeout
has elapsed and short circuits it immediately.
Fixes #1263
|
| |
|
|
|
|
|
|
| |
Helps identify problematic or buggy code. When a warning is displayed,
it should be analyzed and fixed.
The r and r2 fixture now close the client after the test is complete.
|
|
|
|
|
|
|
|
|
| |
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` 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
| |
Better thread and fork safety for ConnectionPool and BlockingConnectionPool
|
|
|
|
| |
Fixed #1220
|
| |
|
|
|
|
|
|
|
|
| |
'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
|
|
|
|
|
|
| |
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.
|
|
|
| |
PubSub objects are now context managers.
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
While numbers are frequently singletons as an optimization, it is not
guaranteed by the language specification. Fixes flake8 error:
F632 use ==/!= to compare str, bytes, and int literals
|
|
|
| |
Add equality test on Redis client and connection pool
|
|
|
|
| |
keys
|
|
|
| |
Fix test suite with Redis versions pre-5.0.0
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Fixes #1200
|
|
|
|
|
|
|
|
|
|
| |
Commands sent on pubsub connections (like subscribe, psusbscribe, etc.) do
not wait for the server to acknowledge a reply. This can lead to situations
where commands are executed out of order. This is more noticeable on laggy
connections.
This fix ensures that all anticipated messages are read off the pubsub
connection before proceeding to the next command
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes #1191
|
|
|
|
|
|
|
| |
This replaces the work in 3.2.0 to use nonblocking sockets instead of
selectors. Selectors proved to be problematic for some environments
including eventlet and gevent. Nonblocking sockets should be available
in all environments.
|
| |
|
|
|
| |
Users can now specify --redis-url when running the test suite to choose a specific server.
|
|
|
|
|
|
|
| |
AuthenticationError is now a subclass of ConnectionError, which means
the connection will be shut down and cleaned up.
Fixes #923
|
|
|
|
|
| |
Pass encoding_errors setting to hiredis (>=1.0.0).
Fixes #1161
|
|
|
|
|
|
|
| |
this change allows users to call client.execute_command('info') or
client.execute_command('INFO') and get the same parsed result.
Fixes #1168
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds redis.selector, a module that provides the best selector strategy
available on the current platform. A redis.selector polls a socket to
provide two pieces of functionality:
1. Check whether data can be read from the socket. Prior versions of redis-py
provided this behavior with just select.select(). select() has lots of
limitations, most notably a limit of ~1024 file descriptors. Now that
better selectors are available, this should make can_read() faster and
able to accomodate more clients. See #1115 and #486
2. Check whether a socket is ready for a command to be sent. This doubles
as a health check. It ensures that the socket is available for writing,
has no data to read and has no known errors. Anytime a socket is
disconnected or hung up, data is available to be read, typically zero bytes.
ConnectionPool.get_connection has been modified to ensure that connections
it returns are connected and are ready for a command to be sent. If
get_connection encounters a case where a socket isn't ready for a command
the connection is reconnected and checked again.
TODO: more tests for this stuff. implement EPoll and KQueue selectors.
Fixes #1115
Fixes #486
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes a process with an active connection to Redis forks and creates
child processes taht also want to talk to Redis. Prior to this change there
were a number of potential conflicts that could cause this to fail.
Retrieving a connection from the pool and releasing a connection back
to the pool check the current proceeses PID. If it's different than the
PID that created the pool, reset() is called to get a fresh set of connections
for the current process. However in doing so, pool.disconnect() was caused
which closes the file descriptors that the parent may still be using. Further
when the available_connections and in_use_connections lists are reset, all of
those connections inherited from the parent are GC'd and the connection's
`__del__` was called, which also closed the socket and file descriptor.
This change prevents pool.disconnect() from being called when a pid is changed.
It also removes the `__del__` destructor from connections. Neither of these
are necessary or practical. Child processes still reset() their copy of the
pool when first accessed causing their own connections to be created.
`ConnectionPool.disconnect()` now checks the current process ID
so that a child or parent can't disconnect the other's connections.
Additionally, `Connection.disconnect()` now checks the current process ID
and only calls `socket.shutdown()` if `disconnect()` is called by the same
process that created the connection. This allows for a child process that
inherited a connection to call `Connection.disconnect()` and not shutdown
the parent's copy of the socket.
Fixes #863
Fixes #784
Fixes #732
Fixes #1085
Fixes #504
|
|\ |
|
| | |
|