Class: PublishedMessage

Inherits:
ActiveRecord::Base show all
Defined in:
lib/generators/aws_sqs_moniter/templates/published_message.rb

Class Method Summary collapse

Methods inherited from ActiveRecord::Base

connection_with_forbid_implicit, forbid_implicit_checkout!, implicit_checkout_forbidden?

Class Method Details

.sent_by(publisher_id, timestamp) ⇒ Object



8
9
10
# File 'lib/generators/aws_sqs_moniter/templates/published_message.rb', line 8

def self.sent_by publisher_id, timestamp
  where(published_by: publisher_id, attempted_at: timestamp)
end

.unsentObject



2
3
4
5
6
# File 'lib/generators/aws_sqs_moniter/templates/published_message.rb', line 2

def self.unsent
  where(published_at: nil)
    .where('attempted_at IS NULL OR (attempted_at <= ?)', 1.minute.ago)
    .order(created_at: :asc)
end