Class: Neetodeploy::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/neetodeploy/autoscale/middleware.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



11
12
13
14
# File 'lib/neetodeploy/autoscale/middleware.rb', line 11

def initialize(app)
  @app = app
  init_worker
end

Instance Attribute Details

#workerObject (readonly)

Returns the value of attribute worker.



9
10
11
# File 'lib/neetodeploy/autoscale/middleware.rb', line 9

def worker
  @worker
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/neetodeploy/autoscale/middleware.rb', line 16

def call(env)
  payload = URI.encode_www_form(
    app_name: ENV.to_h["NEETODEPLOY_APP_NAME"],
    process_type: "web",
    queue_time: queue_time(env)
  )
  worker.push(payload)
  @app.call(env)
end