Fix race create sessione su CPX: ready solo dopo MediaMTX.
I nodi cloud restano in provisioning finché :9997 risponde; retry su create_path e 503 retryable se l’ingest è ancora irraggiungibile. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -224,4 +224,41 @@ RSpec.describe Streams::Autoscaler do
|
||||
expect(described_class.within_budget?(1)).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
it "promotes provisioning nodes when MediaMTX becomes reachable" do
|
||||
with_env(
|
||||
"STREAM_AUTOSCALE_ENABLED" => "1",
|
||||
"STREAM_AUTOSCALE_WARM_SPARE" => "0",
|
||||
"STREAM_AUTOSCALE_SOFT_FREE_SLOTS" => "0",
|
||||
"STREAM_AUTOSCALE_KIND" => "lab",
|
||||
"MEDIAMTX_API_URL" => "http://mtx-home:9997",
|
||||
"MEDIAMTX_RTMP_URL" => "rtmp://home.example:1935",
|
||||
"HLS_PUBLIC_URL" => "https://home.example/hls"
|
||||
) do
|
||||
Streams::NodeRegistry.ensure_home_from_env!
|
||||
node = StreamNode.create!(
|
||||
slug: "ingest-lab-prov",
|
||||
hostname: "prov.lab",
|
||||
role: "lab",
|
||||
status: "provisioning",
|
||||
provider: "local",
|
||||
rtmp_base_url: "rtmp://h:1935",
|
||||
hls_base_url: "https://h/hls",
|
||||
api_base_url: "http://h:9997",
|
||||
max_publishers: 2,
|
||||
max_relays: 2
|
||||
)
|
||||
allow(Streams::NodeHealth).to receive(:promote_if_healthy!) do |n|
|
||||
n.update!(status: "ready", last_health_at: Time.current)
|
||||
true
|
||||
end
|
||||
|
||||
provisioner = instance_double(Streams::NodeProvisioner)
|
||||
expect(provisioner).not_to receive(:provision_lab!)
|
||||
|
||||
result = described_class.reconcile!(provisioner: provisioner)
|
||||
expect(result.actions).to include(:"ready_ingest-lab-prov")
|
||||
expect(node.reload.status).to eq("ready")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user