Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 2 additions & 20 deletions src/cluster_commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Loading