We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
defer_stop
1 parent 896baed commit 84a9e1dCopy full SHA for 84a9e1d
1 file changed
examples/sleep/config.ru
@@ -4,21 +4,17 @@ require 'async'
4
run do
5
body = Async::HTTP::Body::Writable.new
6
7
- Async do
8
- 30.times do
9
- body.write "(#{Time.now}) Hello World #{Process.pid}\n"
10
- sleep 1
+ Async do |task|
+ task.defer_stop do
+ 30.times do
+ body.write "(#{Time.now}) Hello World #{Process.pid}\n"
11
+ sleep 1
12
+ end
13
end
14
ensure
15
+ Console.info(self, "Closing body...")
16
body.close
17
18
19
[200, {}, body]
20
-
-# Run the server:
-# > falcon serve --count 1 --bind http://localhost:9292
21
22
-# Measure the concurrency:
23
-# > benchmark-http concurrency -t 1.2 -c 0.9 http://localhost:9292
24
0 commit comments