diff --git a/src/consts.jl b/src/consts.jl index b0864652..98db1f73 100644 --- a/src/consts.jl +++ b/src/consts.jl @@ -21,7 +21,7 @@ const DEFAULT_CONNECT_ARGS = ( headers = true, nkey = nothing ) -const OUTBOX_SIZE = 1000000 +const OUTBOX_SIZE = 10000000 const SOCKET_CONNECT_DELAYS = Base.ExponentialBackOff(n=1000, first_delay=0.5, max_delay=1) const SUBSCRIPTION_CHANNEL_SIZE = 10000 diff --git a/test/benchmarks.jl b/test/benchmarks.jl index 40e61bdd..a89a4478 100644 --- a/test/benchmarks.jl +++ b/test/benchmarks.jl @@ -123,4 +123,21 @@ end unsubscribe(sub; connection) @info "$counter requests / second." NATS.status() +end + +@testset "Publisher benchmark." begin + connection = NATS.connect(async_handlers = false, default = false) + + tm = Timer(1.0) + counter = 0 + while isopen(tm) + if Base.n_avail(connection.outbox) > 5000 + sleep(0.001) + continue + end + publish("zxc"; payload = "Hello world!!!!!", connection) + counter = counter + 1 + end + + @info "Published $counter messages." end \ No newline at end of file