| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
implementation/behavior (related to #1085).
When hiredis is installed and HiredisParser is used (implicitly),
connection can not be securily shared between process forks.
|
|\ \
| | |
| | | |
Skip 64-bit specific tests. (Closes: #899)
|
| | |
| | |
| | |
| | | |
Signed-off-by: Chris Lamb <lamby@debian.org>
|
| | |
| | |
| | |
| | |
| | | |
Fixes #969
Fixes #961
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \ |
|
| | |/
| |/| |
|
|/ /
| |
| |
| |
| |
| | |
messages
Signed-off-by: Xabier Eizmendi <xeizmendi@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Lock.acquire() can now be provided a token. If provided, this value will be
used as the value stored in Redis to hold the lock.
Lock.owned() returns a boolean indicating whether the lock is owned by the
current instance.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`Lock` class provides a method called `.extend()` to manage a TTL of the
acquired lock. However, the method allows only to extend a timeout of
existing lock by N seconds, there's no way you can reset a TTL to the
timeout value you passed to this lock. There could be multiple use cases
for such behaviour. For instance, one may want to use a lock to
implement active/passive behaviour where only one process owns a lock
and resets its TTL all over again until it dies. This commit adds a new
method called `.reacquire()` to reset a TTL of the acquired lock back to
the passed timeout value.
|
| |
| |
| |
| | |
Stream message now respect the decode_responses flag.
|
| |
| |
| |
| |
| |
| |
| | |
Redis versions 5.0.1 require messages to be read with the special ID '>'
when using XREADGROUP
Fixes #1073
|
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | | |
Add client kill with filter
|
| | |
| | |
| | |
| | | |
Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
|
| | |
| | |
| | |
| | | |
Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
|
| | |
| | |
| | |
| | | |
Signed-off-by: Theo Despoudis <thdespou@hotmail.com>
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Using the locking routines, it is useful to be able to
distingush a generic lock error from a one that is related
to the lock not being owned anymore (without doing string
checks); this allows say a lock extension thread to attempt
to re-acquire the lock in this case (vs just dying).
|
| | |
|
|/ |
|
| |
|
|\
| |
| | |
Fixes a KeyError in empty `options` dict at sort's return
|
| |
| |
| |
| | |
Fixes #924
|
| |
| |
| |
| | |
Fixes #939
|
| |
| |
| |
| |
| |
| |
| | |
Lock.locked() returns a boolean indicating if the lock is acquired and valid.
Thanks Alan Justino da Silva
Fixes #1007
|
| |
| |
| |
| |
| |
| | |
Fixes #1053
Fixes #635
Fixes #766
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes #649
Fixes #954
Fixes #638
Fixes #721
Fixes #955
|
| |
| |
| |
| |
| | |
Fixes #621
Fixes #927
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Everyone is using Redis 2.6 or greater, right? The Lua lock implementation
is so much nicer and less buggy.
Fixes #1031
Fixes #902
Fixes #793
Fixes #610
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
All input sent to Redis is coerced into bytes. This includes key names and
values. Prior to this change, redis-py made an effort to cooerce all input
into strings by calling str() (Python 3) or unicode() (Python 2). While this
works for a handful of types like ints, longs and floats, it fails for other
types like bools ('True' or 'False'), None ('None') and many user defined
types.
Starting with redis-py version 3.0, sending input of any other type is
considered an error an a DataError exception will be raised.
Fixes #471
Fixes #472
Fixes #321
Fixes #190
|
| |
| |
| |
| | |
fixes #571
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
redis-py maintained backwards compatibility by keeping the old "Redis"
class around for quite some time. While no doubt a convenience for folks
who relied on it, the presence of both Redis and StrictRedis causes
a number of support issues and general confusion. With 3.0, we're
breaking a few things to make redis-py better going forward.
This change removes the old Redis class. We also renamed the StrictRedis
class to Redis and aliased StrictRedis to Redis. For people that have
been using StrictRedis, this should not change anything. You can continue
doing things as you are.
People still using the legacy Redis class will need to update the argument
order for the SETEX, LREM and ZADD commands. Additionally, the return values
for TTL and PTTL now return the integer values -1 when a key exists but
has no expire time and -2 when a key does not exist. Previously these
cases returned a None value in the Redis class.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously MSET, MSETNX and ZADD accepted multiple ways to specify the
mapping of keys to values including via **kwargs. This turned out to be
a poor choice. As Redis evolved and added additional options to the ZADD
command, these options couldn't be specified in redis-py without possible
element name conflictd. This fixes that going forward and makes the commands
simpler.
|
|\ \
| | |
| | | |
CLIENT PAUSE and type argument in client_list
|
| | | |
|