blob: bd2bf7d91e9b6e34e38e5a047f557c39e21914f2 (
plain) (
tree)
|
|
class ActionMailbox::InboundEmail::Incineratable::Incineration
def initialize(inbound_email)
@inbound_email = inbound_email
end
def run
@inbound_email.destroy if due? && processed?
end
private
def due?
@inbound_email.updated_at < ActionMailbox::InboundEmail::Incineratable::INCINERATABLE_AFTER.ago.end_of_day
end
def processed?
@inbound_email.delivered? || @inbound_email.failed?
end
end
|