diff --git a/examples/sleep/config.ru b/examples/sleep/config.ru index e3ec94c2..5cbf373c 100644 --- a/examples/sleep/config.ru +++ b/examples/sleep/config.ru @@ -4,21 +4,17 @@ require 'async' run do body = Async::HTTP::Body::Writable.new - Async do - 30.times do - body.write "(#{Time.now}) Hello World #{Process.pid}\n" - sleep 1 + Async do |task| + task.defer_stop do + 30.times do + body.write "(#{Time.now}) Hello World #{Process.pid}\n" + sleep 1 + end end ensure + Console.info(self, "Closing body...") body.close end [200, {}, body] end - -# Run the server: -# > falcon serve --count 1 --bind http://localhost:9292 - -# Measure the concurrency: -# > benchmark-http concurrency -t 1.2 -c 0.9 http://localhost:9292 -