Alza soft capacity fase A e aggiunge quiet hours CPX notturne.

Home a 4 e cloud a 6 con MAX_NODES=12 (~76 soft); di notte (02–07 Europe/Rome) niente scale-out/warm-spare e sweeper che chiude i CPX idle.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 09:48:50 +02:00
co-authored by Cursor
parent d52434fb2e
commit 7c7b2bf14c
16 changed files with 513 additions and 25 deletions
@@ -0,0 +1,40 @@
# frozen_string_literal: true
require "rails_helper"
RSpec.describe Streams::QuietHours do
def with_env(vars)
previous = vars.keys.index_with { |k| ENV[k] }
vars.each { |k, v| ENV[k] = v }
yield
ensure
previous.each { |k, v| v.nil? ? ENV.delete(k) : ENV[k] = v }
end
it "is active inside the Rome window" do
with_env(
"STREAM_AUTOSCALE_QUIET_HOURS" => "02:00-07:00",
"STREAM_AUTOSCALE_QUIET_TZ" => "Europe/Rome"
) do
now = Time.find_zone!("Europe/Rome").local(2026, 9, 5, 3, 30)
expect(described_class.active?(now: now)).to eq(true)
end
end
it "is inactive outside the window" do
with_env(
"STREAM_AUTOSCALE_QUIET_HOURS" => "02:00-07:00",
"STREAM_AUTOSCALE_QUIET_TZ" => "Europe/Rome"
) do
now = Time.find_zone!("Europe/Rome").local(2026, 9, 5, 10, 0)
expect(described_class.active?(now: now)).to eq(false)
end
end
it "can be disabled with off" do
with_env("STREAM_AUTOSCALE_QUIET_HOURS" => "off") do
now = Time.find_zone!("Europe/Rome").local(2026, 9, 5, 3, 0)
expect(described_class.active?(now: now)).to eq(false)
end
end
end