Created
December 11, 2017 07:56
-
-
Save tagomoris/ae068d7b2380095ab5e721d8c0b219d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
access-log: /dev/null | |
hosts: | |
"localhost": | |
listen: 8384 | |
paths: | |
"/t": | |
mruby.handler: | | |
class Foo | |
def initialize(ch, a) | |
@ch = ch | |
task do | |
@ch.push a | |
end | |
end | |
end | |
Proc.new do |env| | |
begin | |
ch = H2O::Channel.new | |
f1 = Foo.new(ch, "a") | |
f2 = Foo.new(ch, "b") | |
str = '' | |
2.times{ str << ch.shift } | |
[200, {}, [str]] | |
rescue => e | |
puts "Unexpected error #{e.class}:#{e.message}" | |
e.backtrace.each do |bt| | |
puts "\t#{bt}" | |
end | |
[500, {}, [e.message]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment