2020-03-01 13:36:13 +00:00
|
|
|
class ConversationReplyEmailWorker
|
2020-01-23 17:29:07 +00:00
|
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: :mailers
|
|
|
|
|
|
|
|
def perform(conversation_id, queued_time)
|
|
|
|
@conversation = Conversation.find(conversation_id)
|
|
|
|
|
|
|
|
# send the email
|
2020-03-01 13:36:13 +00:00
|
|
|
ConversationReplyMailer.reply_with_summary(@conversation, queued_time).deliver_later
|
2020-01-23 17:29:07 +00:00
|
|
|
|
|
|
|
# delete the redis set from the first new message on the conversation
|
|
|
|
conversation_mail_key = Redis::Alfred::CONVERSATION_MAILER_KEY % @conversation.id
|
|
|
|
Redis::Alfred.delete(conversation_mail_key)
|
|
|
|
end
|
|
|
|
end
|