Class: ThreeScale::Backend::ApplicationEvents

Inherits:
Object
  • Object
show all
Extended by:
StorageKeyHelpers
Defined in:
lib/3scale/backend/application_events.rb

Defined Under Namespace

Classes: PingFailed

Constant Summary collapse

DAILY_KEY_TTL =
172_800
Error =
Class.new StandardError

Class Method Summary collapse

Methods included from StorageKeyHelpers

encode_key

Class Method Details

.generate(applications) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/3scale/backend/application_events.rb', line 29

def self.generate(applications)
  return if applications.nil? || applications.empty?
  applications.each do |application|
    service_id     = application[:service_id]
    application_id = application[:application_id]

    first_traffic(service_id, application_id)
    first_daily_traffic(service_id, application_id)
  end
end

.pingObject

ping the frontend if any event is pending for processing



23
24
25
26
27
# File 'lib/3scale/backend/application_events.rb', line 23

def self.ping
  EventStorage.ping_if_not_empty
rescue => e
  raise PingFailed.new(e)
end