From 02880baa9bec6d9d51d5ab34ae3e9f7a35a48977 Mon Sep 17 00:00:00 2001 From: tan Date: Thu, 18 Jun 2026 14:11:45 +0530 Subject: [PATCH] fix: precompilation and conflicting cluster _time - Remove duplicate include("connection.jl") from parser.jl; it is already included by Redis.jl before parser.jl, so the redundant include triggered a precompilation failure. - Drop "_time" from CLUSTER_MULTI_KEY_COMMANDS so `@redisfunction` generates `_time(::RedisClusterConnection)` automatically. This was otherwise resulting in a function override warning during precompilation. - Remove the now-redundant hand-written _time(::RedisClusterConnection). fixes: #119 --- src/client.jl | 2 +- src/cluster_commands.jl | 22 ++-------------------- src/parser.jl | 2 -- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/client.jl b/src/client.jl index 13e68be..91b613f 100644 --- a/src/client.jl +++ b/src/client.jl @@ -27,7 +27,7 @@ const CLUSTER_MULTI_KEY_COMMANDS = Set([ "eval", "evalsha", # Server commands - need to broadcast to all nodes - "flushall", "flushdb", "_time", + "flushall", "flushdb", # Pub/Sub commands - need special handling "publish" diff --git a/src/cluster_commands.jl b/src/cluster_commands.jl index 5a89aa9..aecb1b7 100644 --- a/src/cluster_commands.jl +++ b/src/cluster_commands.jl @@ -705,29 +705,11 @@ function flushdb(cluster::RedisClusterConnection, db::Integer) return "OK" end -""" - _time(cluster::RedisClusterConnection) - -Cluster version of TIME - returns time from a random node. -Returns current Unix time from one of the cluster nodes. -""" -function _time(cluster::RedisClusterConnection) - if isempty(cluster.node_connections) - throw(ConnectionException("No active connections in cluster")) - end - - # Get time from a random master node - connections = collect(values(cluster.node_connections)) - random_conn = rand(connections) - - response = execute_command(random_conn, ["TIME"]) - return convert_response(Array{AbstractString,1}, response) -end - """ time(cluster::RedisClusterConnection) -Cluster version of TIME - returns DateTime from a random node. +Cluster version of TIME - returns DateTime from a cluster node. +Uses the `_time` method generated by `@redisfunction`. """ function time(cluster::RedisClusterConnection) t = _time(cluster) diff --git a/src/parser.jl b/src/parser.jl index a3fa2cf..53bfea1 100644 --- a/src/parser.jl +++ b/src/parser.jl @@ -2,8 +2,6 @@ Formatting of incoming Redis Replies """ -include("connection.jl") - function getline(t::Transport.RedisTransport) l = chomp(Transport.read_line(t)) length(l) > 1 || throw(ProtocolException("Invalid response received: $l"))