Sha256: 6bbe44b20c1d3e7920c216f7dde754c735ee78062bc5fd11df32331676d2ff5b

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 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

6 entries across 6 versions & 1 rubygems

Version Path
spiderfw-0.5.19 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.18 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.17 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.16 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.15 lib/spiderfw/controller/first_responder.rb
spiderfw-0.5.14 lib/spiderfw/controller/first_responder.rb