Evita doppi ffmpeg tra host: stop solo sull'owner, ensure con requeue a capacità piena e coda Sidekiq youtube_relay isolata. Co-authored-by: Cursor <cursoragent@cursor.com>
19 lines
705 B
Ruby
19 lines
705 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
RSpec.describe YoutubeRelayStopJob, type: :job do
|
|
it "requeues when stop runs on the wrong host" do
|
|
session = instance_double(StreamSession, id: SecureRandom.uuid)
|
|
allow(StreamSession).to receive(:find_by).and_return(session)
|
|
allow(Streams::YoutubeRelay).to receive(:worker?).and_return(true)
|
|
allow(Streams::YoutubeRelay).to receive(:stop_on_worker!).and_return(:wrong_host)
|
|
|
|
job_proxy = double("ConfiguredJob")
|
|
expect(described_class).to receive(:set).with(wait: 2.seconds).and_return(job_proxy)
|
|
expect(job_proxy).to receive(:perform_later).with(session.id, 1)
|
|
|
|
described_class.new.perform(session.id, 0)
|
|
end
|
|
end
|