Sha256: 5c298328b253f9ca8af56ab130f83c818388f3afc96513a1d82d9f95e3f2578f

Contents?: true

Size: 1.74 KB

Versions: 13

Compression:

Stored size: 1.74 KB

Contents

module Spider
    
    module FirstResponder
        
        def before(action='', *arguments)
            # if (Spider.conf.get('profiling.enable') && @request.env['QUERY_STRING'] =~ /profile=true/)
            #     unless Spider.request_mutex
            #         Spider.mutex_requests!
            #         Spider.request_mutex.lock
            #     end
            #     require 'ruby-prof'
            #     RubyProf.start
            #     @profiling_started = true
            # end
            catch :done do
                begin
                    super
                rescue => exc
                    try_rescue(exc)
                end
            end
        end
        
        def execute(action='', *arguments)
            catch :done do
                begin
                    super
                rescue => exc
                    try_rescue(exc)
                end
            end
        end
        
        def after(action='', *arguments)
            catch :done do
                begin
                    super
                rescue => exc
                    try_rescue(exc)
                end
            end
            # if (@profiling_started)
            #     debugger
            #     Spider.request_mutex.unlock
            #     Spider.request_mutex = nil
            #     result = RubyProf.stop
            #     printer = ::RubyProf::GraphHtmlPrinter.new(result)
            #     file_name = Spider.paths[:tmp]+"/prof_#{DateTime.now.to_s}.html"
            #     File.open(file_name, 'w') do |f|
            #         printer.print(f, :min_percent => 0)
            #     end
            #     Spider.logger.info("Written profiling info in #{file_name}")
            # end
            
        end
        
    end
    
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spiderfw-0.5.13 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.12 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.11 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.10 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.9 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.7 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.6 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.5 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.4 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.3 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.2 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.1 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5 lib/spiderfw/controller/first_responder.rb