diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-03-06 21:25:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 21:25:34 +0200 |
commit | c4e408880c0fbfe714cd9ad4e1e6b908f00be9b5 (patch) | |
tree | e48ca1c20160c296b60569eaea0b277a168e67ef /redis/cluster.py | |
parent | 6c798df564b644bdad1d7e09f1d750e4fee34848 (diff) | |
download | redis-py-c4e408880c0fbfe714cd9ad4e1e6b908f00be9b5.tar.gz |
Add cluster support for functions (#2016)
* cluster support for functions
* fix test_list_on_cluster mark
* fix mark
* cluster unstable url
* fix
* fix cluster url
* skip tests
* linters
* linters
Diffstat (limited to 'redis/cluster.py')
-rw-r--r-- | redis/cluster.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/redis/cluster.py b/redis/cluster.py index 4b327ad..8c2dfc2 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -292,6 +292,11 @@ class RedisCluster(RedisClusterCommands): [ "FLUSHALL", "FLUSHDB", + "FUNCTION DELETE", + "FUNCTION FLUSH", + "FUNCTION LIST", + "FUNCTION LOAD", + "FUNCTION RESTORE", "SCRIPT EXISTS", "SCRIPT FLUSH", "SCRIPT LOAD", @@ -299,6 +304,10 @@ class RedisCluster(RedisClusterCommands): PRIMARIES, ), list_keys_to_dict( + ["FUNCTION DUMP"], + RANDOM, + ), + list_keys_to_dict( [ "CLUSTER COUNTKEYSINSLOT", "CLUSTER DELSLOTS", @@ -916,6 +925,10 @@ class RedisCluster(RedisClusterCommands): else: keys = self._get_command_keys(*args) if keys is None or len(keys) == 0: + # FCALL can call a function with 0 keys, that means the function + # can be run on any node so we can just return a random slot + if command in ("FCALL", "FCALL_RO"): + return random.randrange(0, REDIS_CLUSTER_HASH_SLOTS) raise RedisClusterException( "No way to dispatch this command to Redis Cluster. " "Missing key.\nYou can execute the command by specifying " |