Sha256: 7b198a702df3152b48cc0b180f84933f05d43d4f5cc607547072c5dfe4bf22b3

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

module Chillout
  module Middleware
    class CreationsMonitor
      def initialize(app, client)
        @app = app
        @client = client
      end

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

      def _call(env)
        status, headers, body = @app.call(env)
        return status, headers, body
      ensure
        if creations = Chillout.creations
          @client.logger.debug "Non-empty creations container found"
          @client.enqueue(creations)
          Chillout.creations = nil
        end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chillout-0.8.9 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.5.1 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.8 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.7 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.6 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.5 lib/chillout/middleware/creations_monitor.rb
chillout-0.8.4 lib/chillout/middleware/creations_monitor.rb