Sha256: 4081100c524353ae81fe95d0bf2425f59f2fa18886586a7171e5d9d2992eef7b

Contents?: true

Size: 904 Bytes

Versions: 4

Compression:

Stored size: 904 Bytes

Contents

module Jets
  class Prewarm
    class << self
      include Jets::Util::Logging

      # 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"
      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

      delegate :stats, to: Jets::Shim::Adapter::Prewarm
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/prewarm.rb
jets-6.0.4 lib/jets/prewarm.rb
jets-6.0.3 lib/jets/prewarm.rb
jets-6.0.2 lib/jets/prewarm.rb