diff --git a/lib/leopard/nats_api_server.rb b/lib/leopard/nats_api_server.rb index f2d12cc..0d74088 100644 --- a/lib/leopard/nats_api_server.rb +++ b/lib/leopard/nats_api_server.rb @@ -76,7 +76,8 @@ def use(klass, *args, &block) def run(nats_url:, service_opts:, instances: 1, blocking: true) logger.info 'Booting NATS API server...' # Return the thread pool if non-blocking - return spawn_instances(nats_url, service_opts, instances) unless blocking + pool = spawn_instances(nats_url, service_opts, instances) + return pool unless blocking # Otherwise, just sleep the main thread forever sleep