Class: Chillout::Middleware::CreationsMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/chillout/middleware/creations_monitor.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, client) ⇒ CreationsMonitor

Returns a new instance of CreationsMonitor.



4
5
6
7
# File 'lib/chillout/middleware/creations_monitor.rb', line 4

def initialize(app, client)
  @app = app
  @client = client
end

Instance Method Details

#_call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chillout/middleware/creations_monitor.rb', line 13

def _call(env)
  status, headers, body = @app.call(env)
  return status, headers, body
ensure
  if Thread.current[:creations]
    @client.logger.info "Non-empty creations container found"
    @client.enqueue(Thread.current[:creations])
    Thread.current[:creations] = nil
  end

  body.close if body && body.respond_to?(:close) && $!
end

#call(env) ⇒ Object



9
10
11
# File 'lib/chillout/middleware/creations_monitor.rb', line 9

def call(env)
  dup._call(env)
end