Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Changes on requeue-strategy for main at the time it was submitted #1

Open
wants to merge 66 commits into
base: initial_main_for_requeue_strategy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
03e0cd2
Job can have a requeue_strategy, which is always :enqueue
lavaturtle Jun 27, 2023
b809c2f
Add :schedule option for requeue_strategy
lavaturtle Jun 28, 2023
68710ee
allow setting default_requeue_strategy on configuration
lavaturtle Jun 29, 2023
39f255c
add some random jitter
lavaturtle Jun 29, 2023
b71ccdd
disable rubocop Style/RedundantCurrentDirectoryInPath
lavaturtle Jun 29, 2023
92b8d3d
rename requeue_strategy to requeue_with
lavaturtle Jun 30, 2023
37c905a
store requeue_with via sidekiq_class_attribute, rather than in the St…
lavaturtle Jun 30, 2023
ce5745d
allow specifying which queue throttled jobs should be sent to
lavaturtle Jun 30, 2023
122e6e1
accept a Proc for :with and :to arguments
lavaturtle Jun 30, 2023
dd0f771
fix: middleware not finalizing correctly when job is ActiveJob
malavbhavsar Jul 26, 2023
b124844
Update CHANGES.md with #151
ixti Aug 12, 2023
4bb6254
lint: Fix rubocop rules
ixti Aug 18, 2023
b3221ea
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 4, 2023
37a1f1d
Fix typo `sidkiq_options` (#158)
nthx Oct 17, 2023
7c0dbdb
Replace "end" with "head" in test cases (#156)
yykamei Oct 17, 2023
479c06d
cleanup: Drop ruby-2.7.x support
ixti Nov 17, 2023
fa2d701
cleanup: Drop sidekiq-6.x.x support
ixti Nov 17, 2023
d263ba9
fix: Better patch BasicFetch
ixti Nov 17, 2023
0b42a9e
refactor: Remove configuration object
ixti Nov 18, 2023
934bdd9
feat!: Revive queues cooldown manager
ixti Nov 18, 2023
b2949cc
cleanup: Use Hash#[] instead of fetch
ixti Nov 20, 2023
f6776b8
Release v1.0.0
ixti Nov 20, 2023
7a4db28
Release v1.0.1
ixti Nov 20, 2023
bd63f83
refactor!: Deprecate setup!
ixti Nov 21, 2023
d382193
Release v1.1.0
ixti Nov 21, 2023
f4dc961
doc: Add link to Sidekiq midlewares chain API
ixti Nov 21, 2023
0d8d1a7
doc: Remove warning about 0.x being the stable version
Nov 22, 2023
378b66e
doc: Add SensorTower endorsement
ixti Dec 8, 2023
de57ddd
ci: Add codecov
ixti Dec 12, 2023
81d5a2b
fix: Update rubocop config
ixti Dec 12, 2023
e8eccd4
feat: Add back Ruby-2.7 support
freemanoid Dec 18, 2023
cafb542
ci: Improve output of test matrix
ixti Dec 18, 2023
ff43b39
feat: Add Ruby-3.3 support
ixti Jan 16, 2024
02704ab
lint: Simplify args proxying
ixti Jan 16, 2024
6294b2b
refactor: Extract retrieve_work patch
ixti Jan 16, 2024
bf88735
refactor: Reduce arrays allocation
ixti Jan 16, 2024
ecc602b
feat: Support Sidekiq-Pro super fetch
mnovelo Jan 13, 2024
f0497a5
doc: Fix markup of environment variable name
ixti Jan 18, 2024
659fdfa
Release v1.3.0
ixti Jan 18, 2024
8dbc66d
doc: Fix changelog link of v1.1.0
ixti Jan 18, 2024
b4027cc
ci: Run Sidekiq-Pro test suites if license present (#179)
ixti Jan 19, 2024
6b60bdd
ci: Refactor Sidekiq-Pro tests conditionals (#182)
ixti Jan 26, 2024
1b71da2
ci: bump codecov/codecov-action (#183)
dependabot[bot] Feb 3, 2024
3c1c543
Unwrap ActiveJob arguments (#184)
jlledom Mar 16, 2024
c151789
fix: DRY-up job class/args extraction
ixti Mar 16, 2024
f6a7b0d
chore: Update rubocop config
ixti Apr 7, 2024
26aa058
Release v1.4.0
ixti Apr 7, 2024
f50baab
chore: Drop Sidekiq < 7.0.0 support
ixti Jan 26, 2024
2bc1bb4
chore: Remove deprecated setup! method
ixti Jun 15, 2024
1c0ecaf
lint: Remove deprecated cop department
ixti Jun 15, 2024
39f3f78
Update README.adoc (#191)
woodhull Jul 23, 2024
f1a86f1
fix: Improve cooldown default values (#195)
bdegomme Nov 6, 2024
bca3912
chore: Drop exe/ configuration from gemspec (#193)
olleolleolle Nov 6, 2024
fd22f43
Merge branch 'main' into requeue-strategy
anero Nov 8, 2024
9333560
Update code to work with latest version on main
anero Nov 8, 2024
bdb4c29
Merge branch 'main' into requeue-strategy
anero Nov 8, 2024
d587010
Specs for 'with' option value validation
anero Nov 8, 2024
401b44d
Remove obsolete method for requeueing job on Sidekiq Pro (done from S…
anero Nov 8, 2024
c1b99b5
Skip sidekiq < 7 support
anero Nov 8, 2024
a709e3d
Use stub_job_class for defining stubbed job class
anero Nov 8, 2024
b989300
Update requeue strategy to work with SuperFetch
mnovelo Nov 9, 2024
a1c40e9
Merge pull request #2 from CampusESP/requeue-strategy
anero Nov 11, 2024
11c6d98
Don't reference Sidekiq::Pro::SuperFetch::UnitOfWork class directly i…
anero Nov 12, 2024
2ebf63f
Add specs
mnovelo Nov 13, 2024
39522bc
Fix rubocop warnings
mnovelo Nov 14, 2024
113455f
Merge pull request #3 from CampusESP/requeue-strategy-specs
anero Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ignore:
# Requires Sidekiq-Pro
- lib/sidekiq/throttled/patches/super_fetch.rb
- spec/lib/sidekiq/throttled/patches/super_fetch_spec.rb
49 changes: 35 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ on:

jobs:
test:
name: "rspec (ruby:${{ matrix.ruby }}"

strategy:
fail-fast: false
matrix:
ruby: [ "2.7", "3.0", "3.1", "3.2" ]
name: "test / ${{ matrix.ruby }} / ${{ matrix.redis }}"

runs-on: ubuntu-latest

services:
redis:
image: redis
image: ${{ matrix.redis }}
ports:
- "6379:6379"
options: >-
Expand All @@ -28,26 +23,52 @@ jobs:
--health-timeout 5s
--health-retries 5

env:
BUNDLE_GEMS__CONTRIBSYS__COM: ${{ secrets.BUNDLE_GEMS__CONTRIBSYS__COM }}

strategy:
fail-fast: false
matrix:
ruby: [ ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2, ruby-3.3 ]
redis: [ "redis:6.2", "redis:7.0", "redis:7.2" ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: RSpec
run: scripts/ci-rspec
- name: Run test suites
run: bundle exec rake test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# See: https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
test-finale:
name: "test"

runs-on: ubuntu-latest
if: ${{ always() }}

needs: [test]

steps:
- run: test "success" = "${{ needs.test.result }}"

rubocop:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
ruby-version: ruby-3.2
bundler-cache: true

- run: bundle exec rubocop
- run: bundle exec rake lint
5 changes: 1 addition & 4 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
--backtrace
--color
--format=documentation
--order random
--require simplecov
--require spec_helper
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ AllCops:
- vendor/**/*
NewCops: enable
TargetRubyVersion: 2.7

# Broken: https://github.com/rubocop/rubocop/issues/12113
Bundler/DuplicatedGroup:
Enabled: false
25 changes: 25 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

SimpleCov.start do
gemfile = File.basename(ENV.fetch("BUNDLE_GEMFILE", "Gemfile"), ".gemfile").strip
gemfile = nil if gemfile.empty? || gemfile.casecmp?("gems.rb") || gemfile.casecmp?("Gemfile")

command_name ["#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}", gemfile].compact.join("/")

enable_coverage :branch

if ENV["CI"]
require "simplecov-cobertura"
formatter SimpleCov::Formatter::CoberturaFormatter
else
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::SimpleFormatter,
SimpleCov::Formatter::HTMLFormatter
])
end

add_filter "/demo/"
add_filter "/gemfiles/"
add_filter "/spec/"
add_filter "/vendor/"
end
36 changes: 30 additions & 6 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
# frozen_string_literal: true

appraise "sidekiq-6.5.x" do
group :test do
gem "sidekiq", "~> 6.5.0"
end
end

appraise "sidekiq-7.0.x" do
group :test do
gem "sidekiq", "~> 7.0.0"

# Sidekiq Pro license must be set in global bundler config
# or in BUNDLE_GEMS__CONTRIBSYS__COM env variable
install_if "-> { Bundler.settings['gems.contribsys.com']&.include?(':') }" do
source "https://gems.contribsys.com/" do
gem "sidekiq-pro", "~> 7.0.0"
end
end
end
end

appraise "sidekiq-7.1.x" do
group :test do
gem "sidekiq", "~> 7.1.0"

# Sidekiq Pro license must be set in global bundler config
# or in BUNDLE_GEMS__CONTRIBSYS__COM env variable
install_if "-> { Bundler.settings['gems.contribsys.com']&.include?(':') }" do
source "https://gems.contribsys.com/" do
gem "sidekiq-pro", "~> 7.1.0"
end
end
end
end

appraise "sidekiq-7.2.x" do
group :test do
gem "sidekiq", "~> 7.2.0"

# Sidekiq Pro license must be set in global bundler config
# or in BUNDLE_GEMS__CONTRIBSYS__COM env variable
install_if "-> { Bundler.settings['gems.contribsys.com']&.include?(':') }" do
source "https://gems.contribsys.com/" do
gem "sidekiq-pro", "~> 7.2.0"
end
end
end
end
90 changes: 87 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,88 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Change default cooldown period to `1.0` (was `2.0`),
and cooldown threshold to `100` (was `1`)
[#195](https://github.com/ixti/sidekiq-throttled/pull/195).

### Removed

- Drop Sidekiq < 7 support
- Remove deprecated `Sidekiq::Throttled.setup!`

## [1.4.0] - 2024-04-07

### Fixed

- Correctly unwrap `ActiveJob` arguments:
[#184](https://github.com/ixti/sidekiq-throttled/pull/184),
[#185](https://github.com/ixti/sidekiq-throttled/pull/185).


## [1.3.0] - 2024-01-18

### Added

- Add Sidekiq Pro 7.0, 7.1, and 7.2 support
- Add Ruby 3.3 support


## [1.2.0] - 2023-12-18

### Added

- Bring back Ruby-2.7.x support


## [1.1.0] - 2023-11-21

### Changed

- Renamed `Sidekiq::Throttled::Middleware` to `Sidekiq::Throttled::Middlewares::Server`

### Deprecated

- `Sidekiq::Throttled.setup!` is now deprecated. If you need to change order of
the middleware, please manipulate middlewares chains directly.


## [1.0.1] - 2023-11-20

### Added

- Bring back Sidekiq-6.5 support


## [1.0.0] - 2023-11-20

### Added

- Add Sidekiq-7.2 support
- Revive queues cooldown logic
[#163](https://github.com/ixti/sidekiq-throttled/pull/163)

### Changed

- (BREAKING) Jobs inherit throttling strategy from their parent class, unless
explicitly overriden

### Fixed

- Correctly finalize throttled jobs when used with ActiveJob
[#151](https://github.com/ixti/sidekiq-throttled/pull/151)

### Removed

- (BREAKING) Drop Ruby-2.7.x support
- (BREAKING) Drop Sidekiq-6.x.x support
- (BREAKING) Removed `Sidekiq::Throttled.configuration`


## [1.0.0.alpha.1] - 2023-06-08

### Changes
### Changed

- Upstream `Sidekiq::BasicFetch` is now infused with throttling directly,
thus default fetch configuration should work on both Sidekiq and Sidekiq-Pro
Expand All @@ -30,7 +108,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add Ruby 3.2 support


### Changes
### Changed

- Switch README to Asciidoc format
- Switch CHANGES to keepachangelog.com format
Expand All @@ -46,6 +124,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove queue exclusion from fetcher pon throttled job


[unreleased]: https://github.com/ixti/sidekiq-throttled/compare/v1.0.0.alpha.1...main
[unreleased]: https://github.com/ixti/sidekiq-throttled/compare/v1.4.0...main
[1.4.0]: https://github.com/ixti/sidekiq-throttled/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/ixti/sidekiq-throttled/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/ixti/sidekiq-throttled/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/ixti/sidekiq-throttled/compare/v1.0.1...v1.1.0
[1.0.1]: https://github.com/ixti/sidekiq-throttled/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/ixti/sidekiq-throttled/compare/v1.0.0.alpha.1...v1.0.0
[1.0.0.alpha.1]: https://github.com/ixti/sidekiq-throttled/compare/v1.0.0.alpha...v1.0.0.alpha.1
[1.0.0.alpha]: https://github.com/ixti/sidekiq-throttled/compare/v0.16.1...v1.0.0.alpha
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ group :test do
gem "rack-test"

gem "rspec"

gem "simplecov"
gem "simplecov-cobertura"

gem "timecop"

gem "rubocop", require: false
Expand Down
File renamed without changes.
Loading