Remove Chat Channels Index Job (#5409) [deploy]
This commit is contained in:
parent
f5d3593d4f
commit
5055121361
3 changed files with 0 additions and 51 deletions
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ChatChannels
|
||||
class IndexJob < ApplicationJob
|
||||
queue_as :chat_channels_index
|
||||
|
||||
def perform(chat_channel_id:)
|
||||
chat_channel = ChatChannel.find_by(id: chat_channel_id)
|
||||
return unless chat_channel
|
||||
|
||||
chat_channel.index!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -29,8 +29,6 @@ class Message < ApplicationRecord
|
|||
chat_channel.touch(:last_message_at)
|
||||
chat_channel.index!
|
||||
chat_channel.chat_channel_memberships.reindex!
|
||||
|
||||
ChatChannels::IndexJob.perform_later(chat_channel_id: chat_channel.id)
|
||||
end
|
||||
|
||||
def update_all_has_unopened_messages_statuses
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe ChatChannels::IndexJob, type: :job do
|
||||
include_examples "#enqueues_job", "chat_channels_index", chat_channel_id: 1
|
||||
|
||||
describe "#perform_now" do
|
||||
let_it_be(:chat_channel) { double }
|
||||
let_it_be(:chat_channel_id) { 1 }
|
||||
|
||||
context "when chat_channel is found" do
|
||||
before do
|
||||
allow(ChatChannel).to receive(:find_by).with(id: chat_channel_id).and_return(chat_channel)
|
||||
allow(chat_channel).to receive(:index!)
|
||||
end
|
||||
|
||||
it "calls index" do
|
||||
described_class.perform_now(chat_channel_id: chat_channel_id)
|
||||
|
||||
expect(chat_channel).to have_received(:index!)
|
||||
end
|
||||
end
|
||||
|
||||
context "when chat_channel is not found" do
|
||||
before do
|
||||
allow(ChatChannel).to receive(:find_by).with(id: chat_channel_id).and_return(nil)
|
||||
end
|
||||
|
||||
it "doesn't fail" do
|
||||
expect { described_class.perform_now(chat_channel_id: chat_channel_id) }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue