Class: Jets::Prewarm

Inherits:
Object
  • Object
show all
Extended by:
Util::Logging
Defined in:
lib/jets/prewarm.rb

Class Method Summary collapse

Methods included from Util::Logging

log

Class Method Details

.handle(options = {}) ⇒ Object

Can use to prewarm post deploy Jets::Prewarm.handle Jets::Prewarm.handle(verbose: true, invocation_type: “RequestResponse”) Note: verbose is only useful when invocation_type is “RequestResponse”



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jets/prewarm.rb', line 10

def handle(options = {})
  defaults = {
    function_name: "controller",
    event: '{"_prewarm": 1}'
  }
  options = defaults.merge(options.symbolize_keys)
  # Always calls Lambda, not local
  # Use invoke so messages don't get printed
  Jets::CLI::Call.new(options).invoke
rescue Jets::CLI::Call::Error => e
  puts "ERROR: #{e.message}".color(:red)
  puts "The stack may not be full deployed yet.  Please check the stack and try again."
end