Skip to content

Commit 8da5763

Browse files
author
Сатаров Юрий Сергеевич
committed
[DEX-2891] feat: remove worker v1
1 parent bba5601 commit 8da5763

File tree

11 files changed

+20
-637
lines changed

11 files changed

+20
-637
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
### Fixed
1515

16+
## [7.0.0] - 2025-04-03
17+
18+
### Changed
19+
20+
- BREAKING: remove worker v1 support
21+
1622
## [6.20.0] - 2025-03-31
1723

1824
### Fixed

README.md

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Rails.application.config.outbox.tap do |config|
154154
config.redis = {url: ENV.fetch("REDIS_URL")} # Redis is used as a coordinator service
155155
config.paths << Rails.root.join("config/outbox.yml").to_s # optional; configuration file paths, deep merged at the application start, useful with Rails engines
156156

157-
# optional (worker v2: default)
157+
# optional
158158
config.poller = ActiveSupport::OrderedOptions.new.tap do |pc|
159159
# max parallel threads (per box-item, globally)
160160
pc.concurrency = 6
@@ -184,7 +184,7 @@ Rails.application.config.outbox.tap do |config|
184184
pc.queue_delay = 0.1
185185
end
186186

187-
# optional (worker v2: default)
187+
# optional
188188
config.processor = ActiveSupport::OrderedOptions.new.tap do |pc|
189189
# max threads count (per worker process)
190190
pc.threads_count = 4
@@ -193,26 +193,6 @@ Rails.application.config.outbox.tap do |config|
193193
# BRPOP delay (in seconds) for polling redis job queue per box-item
194194
pc.brpop_delay = 2
195195
end
196-
197-
# optional (worker v1: DEPRECATED)
198-
config.process_items.tap do |x|
199-
# maximum processing time of the batch, after which the batch will be considered hung and processing will be aborted
200-
x.general_timeout = 180
201-
# maximum batch processing time, after which the processing of the batch will be aborted in the current thread,
202-
# and the next thread that picks up the batch will start processing from the same place
203-
x.cutoff_timeout = 60
204-
# batch size
205-
x.batch_size = 200
206-
end
207-
208-
# optional (worker v1: DEPRECATED)
209-
config.worker.tap do |worker|
210-
# number of batches that one thread will process per rate interval
211-
worker.rate_limit = 10
212-
# rate interval in seconds
213-
worker.rate_interval = 60
214-
end
215-
end
216196
```
217197

218198
### Outbox pattern
@@ -642,7 +622,7 @@ end
642622

643623
We would like to see more features added to the web UI. If you have any suggestions, please feel free to submit a pull request 🤗.
644624

645-
## CLI Arguments (v2: default)
625+
## CLI Arguments
646626

647627
| Key | Description |
648628
|----------------------------|----------------------------------------------------------------------|
@@ -651,14 +631,6 @@ We would like to see more features added to the web UI. If you have any suggesti
651631
| `--poll-concurrency or -p` | Number of poller partitions. Default 6. |
652632
| `--poll-threads or -n` | Number of poll threads. Default 1. |
653633
| `--poll-tactic or -t` | Poll tactic. Default "default". |
654-
| `--worker-version or -w` | Worker version. Default 2. |
655-
656-
## CLI Arguments (v1: DEPRECATED)
657-
658-
| Key | Description |
659-
|-----------------------|---------------------------------------------------------------------------|
660-
| `--boxes or -b` | Outbox/Inbox processors to start` |
661-
| `--concurrency or -c` | Number of threads. Default 10. |
662634

663635
## Development & Test
664636

lib/sbmt/outbox.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ def processor_config
6565
@processor_config ||= config.processor
6666
end
6767

68-
def default_worker_version
69-
@default_worker_version ||= config.default_worker_version&.to_i || 2
70-
end
71-
7268
def active_record_base_class
7369
@active_record_base_class ||= config.active_record_base_class.safe_constantize || ::ActiveRecord::Base
7470
end

lib/sbmt/outbox/cli.rb

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,19 @@ def self.exit_on_failure?
3333
aliases: "-t",
3434
type: :string,
3535
desc: "Poll tactic: [default, low-priority, aggressive]"
36-
option :worker_version,
37-
aliases: "-w",
38-
type: :numeric,
39-
desc: "Worker version: [1 | 2]"
4036
def start
4137
load_environment
4238

43-
version = options[:worker_version] || Outbox.default_worker_version
44-
4539
boxes = format_boxes(options[:box])
46-
check_deprecations!(boxes, version)
47-
48-
worker = if version == 1
49-
Sbmt::Outbox::V1::Worker.new(
50-
boxes: boxes,
51-
concurrency: options[:concurrency] || 10
52-
)
53-
elsif version == 2
54-
Sbmt::Outbox::V2::Worker.new(
55-
boxes: boxes,
56-
poll_tactic: options[:poll_tactic],
57-
poller_threads_count: options[:poll_threads],
58-
poller_partitions_count: options[:poll_concurrency],
59-
processor_concurrency: options[:concurrency] || 4
60-
)
61-
else
62-
raise "Worker version #{version} is invalid, available versions: 1|2"
63-
end
40+
check_deprecations!(boxes)
41+
42+
worker = Sbmt::Outbox::V2::Worker.new(
43+
boxes: boxes,
44+
poll_tactic: options[:poll_tactic],
45+
poller_threads_count: options[:poll_threads],
46+
poller_partitions_count: options[:poll_concurrency],
47+
processor_concurrency: options[:concurrency] || 4
48+
)
6449

6550
Sbmt::Outbox.current_worker = worker
6651

@@ -77,9 +62,7 @@ def start
7762

7863
private
7964

80-
def check_deprecations!(boxes, version)
81-
return unless version == 2
82-
65+
def check_deprecations!(boxes)
8366
boxes.each do |item_class|
8467
next if item_class.config.partition_size_raw.blank?
8568

@@ -91,7 +74,6 @@ def load_environment
9174
load(lookup_outboxfile)
9275

9376
require "sbmt/outbox"
94-
require "sbmt/outbox/v1/worker"
9577
require "sbmt/outbox/v2/worker"
9678
end
9779

lib/sbmt/outbox/engine.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ class Engine < Rails::Engine
2929
c.cutoff_timeout = 90
3030
c.batch_size = 200
3131
end
32-
c.worker = ActiveSupport::OrderedOptions.new.tap do |c|
33-
c.rate_limit = 20
34-
c.rate_interval = 60
35-
c.shuffle_jobs = true
36-
end
37-
c.default_worker_version = 2
3832

3933
# worker v2
4034
c.poller = ActiveSupport::OrderedOptions.new.tap do |pc|

lib/sbmt/outbox/v1/thread_pool.rb

Lines changed: 0 additions & 110 deletions
This file was deleted.

lib/sbmt/outbox/v1/throttler.rb

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)