Skip to content

Commit

Permalink
fix unsubscribing
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubwro committed Sep 28, 2023
1 parent 9a98671 commit 42efd59
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ using NATS
include("util.jl")

@testset "Warmup" begin
nc = NATS.connect()
connection = NATS.connect(default = false)
empty!(NATS.state.fallback_handlers)
c = Channel(1000000)
subject = "SOME_SUBJECT"
time_to_wait_s = 1.0
tm = Timer(time_to_wait_s)
sub = subscribe(subject) do msg
sub = subscribe(subject; connection) do msg
if isopen(tm)
try put!(c, msg) catch err @error err end
end
end
publish(subject; payload = "Hi!")
unsubscribe(sub)
publish(subject; payload = "Hi!", connection)
unsubscribe(sub; connection)
sleep(2)
close(c)
NATS.status()
Expand Down Expand Up @@ -102,7 +102,7 @@ end
res = request(subject; connection)
counter = counter + 1
end
unsubscribe(sub)
unsubscribe(sub; connection)
@info "$counter requests / second."
NATS.status()
end
Expand All @@ -120,7 +120,7 @@ end
res = request(subject; connection)
counter = counter + 1
end
unsubscribe(sub)
unsubscribe(sub; connection)
@info "$counter requests / second."
NATS.status()
end

0 comments on commit 42efd59

Please sign in to comment.