Class: Cannon::Middleware::FlushAndBenchmark
- Inherits:
-
Object
- Object
- Cannon::Middleware::FlushAndBenchmark
- Defined in:
- lib/cannon/middleware/flush_and_benchmark.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ FlushAndBenchmark
constructor
A new instance of FlushAndBenchmark.
- #run(request, response, next_proc) ⇒ Object
Constructor Details
#initialize(app) ⇒ FlushAndBenchmark
Returns a new instance of FlushAndBenchmark.
4 5 6 |
# File 'lib/cannon/middleware/flush_and_benchmark.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#run(request, response, next_proc) ⇒ Object
8 9 10 11 |
# File 'lib/cannon/middleware/flush_and_benchmark.rb', line 8 def run(request, response, next_proc) response.flush unless response.flushed? Cannon.logger.debug "Response took #{time_ago_in_ms(request.start_time)}ms" if @app.config.benchmark_requests end |