Skip to content

Commit

Permalink
fix subscription callback invoke and pubsub tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tanmaykm committed Nov 26, 2023
1 parent 8adc065 commit 164417e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ function subscription_loop(conn::SubscriptionConnection, err_callback::Function)
reply = convert_reply(reply)
message = SubscriptionMessage(reply)
if message.message_type == SubscriptionMessageType.Message
conn.callbacks[message.channel](message)
conn.callbacks[message.channel](message.message)
elseif message.message_type == SubscriptionMessageType.Pmessage
conn.pcallbacks[message.channel](message)
conn.pcallbacks[message.channel](message.message)
end
catch err
err_callback(err)
Expand Down
2 changes: 1 addition & 1 deletion test/redis_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ end
return nothing
end
x = Any[]
function f(y::String)
function f(y::AbstractString)
push!(x, y)
end
subs = open_subscription(conn, handleException) #handleException is called when an exception occurs
Expand Down

0 comments on commit 164417e

Please sign in to comment.