Guest User

Untitled

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #encoding: utf-8
  2.  
  3. # Patches async sinatra to use Fiber.new{}.resume for every request
  4.  
  5. require "sinatra/async"
  6. require "fiber"
  7.  
  8. module Sinatra
  9. module Async
  10. module Helpers
  11.  
  12. module_eval %[
  13.  
  14. alias :__async_catch_execute :async_catch_execute
  15.  
  16. def async_catch_execute(&b)
  17. Fiber.new{ __async_catch_execute(&b) }.resume
  18. end
  19.  
  20. ]
  21.  
  22. end
  23. end
  24. end
Add Comment
Please, Sign In to add comment