-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/DEX-2092/v6-improvements' into 'master'
[DEX-2092] fix: per box-based poll rate-limiter + dynamic brpop timeout calculation Closes DEX-2092 See merge request nstmrt/rubygems/outbox!84
- Loading branch information
Showing
6 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Sbmt | ||
module Outbox | ||
VERSION = "6.0.0" | ||
VERSION = "6.0.1" | ||
end | ||
end |
35 changes: 35 additions & 0 deletions
35
spec/lib/sbmt/outbox/v2/poll_throttler/rate_limited_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require "sbmt/outbox/v2/poller" | ||
require "sbmt/outbox/v2/poll_throttler/rate_limited" | ||
|
||
describe Sbmt::Outbox::V2::PollThrottler::RateLimited do | ||
let(:limit) { 60 } | ||
let(:interval) { 60 } | ||
|
||
let(:throttler) { described_class.new(limit: limit, interval: interval) } | ||
let(:task_inbox) do | ||
Sbmt::Outbox::V2::Tasks::Poll.new( | ||
item_class: InboxItem, worker_name: "poller", partition: 0, buckets: [0, 2] | ||
) | ||
end | ||
let(:task_outbox) do | ||
Sbmt::Outbox::V2::Tasks::Poll.new( | ||
item_class: OutboxItem, worker_name: "poller", partition: 0, buckets: [0, 2] | ||
) | ||
end | ||
|
||
it "uses different queues for item classes" do | ||
expect do | ||
throttler.call(0, task_inbox, Sbmt::Outbox::V2::ThreadPool::PROCESSED) | ||
throttler.call(0, task_outbox, Sbmt::Outbox::V2::ThreadPool::PROCESSED) | ||
throttler.call(0, task_inbox, Sbmt::Outbox::V2::ThreadPool::PROCESSED) | ||
throttler.call(0, task_outbox, Sbmt::Outbox::V2::ThreadPool::PROCESSED) | ||
end.to increment_yabeda_counter(Yabeda.box_worker.poll_throttling_counter).with_tags(status: "throttle", throttler: "Sbmt::Outbox::V2::PollThrottler::RateLimited", name: "inbox_item", type: :inbox, worker_name: "poller", worker_version: 2).by(2) | ||
.and increment_yabeda_counter(Yabeda.box_worker.poll_throttling_counter).with_tags(status: "throttle", throttler: "Sbmt::Outbox::V2::PollThrottler::RateLimited", name: "outbox_item", type: :outbox, worker_name: "poller", worker_version: 2).by(2) | ||
.and measure_yabeda_histogram(Yabeda.box_worker.poll_throttling_runtime).with_tags(throttler: "Sbmt::Outbox::V2::PollThrottler::RateLimited", name: "inbox_item", type: :inbox, worker_name: "poller", worker_version: 2) | ||
.and measure_yabeda_histogram(Yabeda.box_worker.poll_throttling_runtime).with_tags(throttler: "Sbmt::Outbox::V2::PollThrottler::RateLimited", name: "outbox_item", type: :outbox, worker_name: "poller", worker_version: 2) | ||
|
||
expect(throttler.queues.count).to eq(2) | ||
end | ||
end |