Skip to content

Commit 164417e

Browse files
committed
fix subscription callback invoke and pubsub tests
The subscription look callbacks were getting invoked with the `SubscriptionMessage` struct. But the docs do not mention that, and seem to suggest that the callback would receive the actual message, which seems natural. The callbacks in tests seem to be expecting the actual message too. Updated the callback invocation to pass the actual message instead of `SubscriptionMessage` struct.
1 parent 8adc065 commit 164417e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/client.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ function subscription_loop(conn::SubscriptionConnection, err_callback::Function)
165165
reply = convert_reply(reply)
166166
message = SubscriptionMessage(reply)
167167
if message.message_type == SubscriptionMessageType.Message
168-
conn.callbacks[message.channel](message)
168+
conn.callbacks[message.channel](message.message)
169169
elseif message.message_type == SubscriptionMessageType.Pmessage
170-
conn.pcallbacks[message.channel](message)
170+
conn.pcallbacks[message.channel](message.message)
171171
end
172172
catch err
173173
err_callback(err)

test/redis_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ end
396396
return nothing
397397
end
398398
x = Any[]
399-
function f(y::String)
399+
function f(y::AbstractString)
400400
push!(x, y)
401401
end
402402
subs = open_subscription(conn, handleException) #handleException is called when an exception occurs

0 commit comments

Comments
 (0)