私は最近、レール3にアップグレードする際に雑種から薄型に切り替えました。切り替えの前に、問題なくEventMachineを使用していました。 thinに切り替えると、EventMachineが呼び出されるたびにサーバーがボブし、返す変数がnilであると言います。EventMachineを薄く使っています
私が薄いと思うのは、おそらくMongrelで使用されていた実装と競合するEventMachineを利用しているからです。私はEventMachineではあまり働いていませんが、EventMachineを別のインスタンスの中で実行してEventMachineをThinによって使用されているものから分離する必要があるようです。正しい軌道にいるのですか? ThinのEventMachineとは別に独自のプロセスで実行するにはどうしたらいいですか?あなたが別々に1を設定する必要はありませんので、ここで
は、我々が現在
def connect
EventMachine.run {
args, options = {
:query => @options[:query],
:head => @options[:headers]
}, {
:connect_timeout => @options[:timeout],
:inactivity_timeout => @options[:timeout]
}
args[:body] = @options[:data] if allow_body?
args[:redirects] = @options[:redirects] if @options[:redirects]
http = EventMachine::HttpRequest.new(@uri, options).send(@options[:method], args)
http.errback {
@response = HttpConnection::Response.new(http, false, @options[:logger])
EventMachine.stop
}
http.callback {
@response = HttpConnection::Response.new(http, true, @options[:logger])
EventMachine.stop
}
}
return @response
end
あなたはすでに、シンナーがEMリアクターを提供していると思います。そして、EM.stopが薄くなって停止することは間違いありません!私はこのEMの実装を完全に打ち切ることにしました。私はSinatraと非同期プラグインを使って見ていきます。ありがとうダン –