Class: Jets::Shim::Adapter::Prewarm
- Inherits:
-
Base
- Object
- Base
- Jets::Shim::Adapter::Prewarm
show all
- Defined in:
- lib/jets/shim/adapter/prewarm.rb
Constant Summary
collapse
- @@prewarm_count =
0
- @@prewarm_at =
nil
Instance Attribute Summary
Attributes inherited from Base
#context, #event, #target
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#log
Class Method Details
.stats ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/jets/shim/adapter/prewarm.rb', line 18
def self.stats
{
boot_at: Jets::Core::Booter.boot_at,
gid: Jets::Core::Booter.gid,
prewarm_at: @@prewarm_at,
prewarm_count: @@prewarm_count
}
end
|
Instance Method Details
#handle ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/jets/shim/adapter/prewarm.rb', line 6
def handle
@@prewarm_count += 1
@@prewarm_at = Time.now.utc
result = self.class.stats
log.info "Prewarm request: #{JSON.dump(result)}" if ENV["JETS_PREWARM_LOG"]
result
end
|
#handle? ⇒ Boolean
14
15
16
|
# File 'lib/jets/shim/adapter/prewarm.rb', line 14
def handle?
event["_prewarm"]
end
|