Created
December 28, 2010 18:27
-
-
Save gregorymostizky/757513 to your computer and use it in GitHub Desktop.
Patches async sinatra to use Fiber.new{}.resume for every request
This file contains hidden or 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
#encoding: utf-8 | |
# Patches async sinatra to use Fiber.new{}.resume for every request | |
require "sinatra/async" | |
require "fiber" | |
module Sinatra | |
module Async | |
module Helpers | |
module_eval %[ | |
alias :__async_catch_execute :async_catch_execute | |
def async_catch_execute(&b) | |
Fiber.new{ __async_catch_execute(&b) }.resume | |
end | |
] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment