From 7a6db06107b0528d47391917511e21205c45f50b Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 3 Dec 2024 09:17:38 +0100 Subject: [PATCH] Rename error to MissingRelatedMessagesError --- app/jobs/fs/download_sent_message_related_messages_job.rb | 6 +++--- .../fs/download_sent_message_related_messages_job_test.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/jobs/fs/download_sent_message_related_messages_job.rb b/app/jobs/fs/download_sent_message_related_messages_job.rb index 902bceed..fd0bd972 100644 --- a/app/jobs/fs/download_sent_message_related_messages_job.rb +++ b/app/jobs/fs/download_sent_message_related_messages_job.rb @@ -1,9 +1,9 @@ module Fs class DownloadSentMessageRelatedMessagesJob < ApplicationJob - class NoRelatedMessagesError < StandardError + class MissingRelatedMessagesError < StandardError end - retry_on NoRelatedMessagesError, attempts: 1 do |_job, _error| + retry_on MissingRelatedMessagesError, attempts: 1 do |_job, _error| # no-op end @@ -16,7 +16,7 @@ def perform(outbox_message, from: nil, to: nil, fs_client: FsEnvironment.fs_clie 0.step do |k| received_messages = fs_api.fetch_received_messages(sent_message_id: outbox_message.metadata['fs_message_id'], page: k + 1, count: batch_size, from: from, to: to) - raise NoRelatedMessagesError if outbox_message.thread.messages.excluding(outbox_message).none? && received_messages['messages'].none? && outbox_message.delivered_at < 1.hour.ago + raise MissingRelatedMessagesError if outbox_message.thread.messages.excluding(outbox_message).none? && received_messages['messages'].none? && outbox_message.delivered_at < 1.hour.ago received_messages['messages'].each do |received_message| ::Fs::DownloadReceivedMessageJob.perform_later(received_message['message_id'], box: outbox_message.box) diff --git a/test/jobs/fs/download_sent_message_related_messages_job_test.rb b/test/jobs/fs/download_sent_message_related_messages_job_test.rb index e48506fe..8c086384 100644 --- a/test/jobs/fs/download_sent_message_related_messages_job_test.rb +++ b/test/jobs/fs/download_sent_message_related_messages_job_test.rb @@ -12,7 +12,7 @@ class Fs::DownloadSentMessageRelatedMessagesJobTest < ActiveJob::TestCase **{sent_message_id: outbox_message.metadata['fs_message_id'], page: 1, count: 25, from: nil, to: nil} FsEnvironment.fs_client.stub :api, fs_api do - assert_raise(Fs::DownloadSentMessageRelatedMessagesJob::NoRelatedMessagesError) do + assert_raise(Fs::DownloadSentMessageRelatedMessagesJob::MissingRelatedMessagesError) do Fs::DownloadSentMessageRelatedMessagesJob.new.perform(outbox_message) end end