sidekiq-throttled 0.13.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +12 -16
- data/.rubocop.yml +14 -94
- data/.rubocop_todo.yml +42 -31
- data/Appraisals +14 -10
- data/CHANGES.md +65 -0
- data/Gemfile +7 -5
- data/LICENSE.md +2 -0
- data/README.md +42 -26
- data/Rakefile +1 -1
- data/gemfiles/sidekiq_6.0.gemfile +7 -5
- data/gemfiles/sidekiq_6.1.gemfile +7 -5
- data/gemfiles/{sidekiq_5.0.gemfile → sidekiq_6.2.gemfile} +8 -6
- data/gemfiles/{sidekiq_5.1.gemfile → sidekiq_6.3.gemfile} +8 -6
- data/gemfiles/{sidekiq_5.2.gemfile → sidekiq_6.4.gemfile} +8 -6
- data/gemfiles/sidekiq_6.5.gemfile +33 -0
- data/lib/sidekiq/throttled/communicator/callbacks.rb +8 -10
- data/lib/sidekiq/throttled/communicator/exception_handler.rb +25 -0
- data/lib/sidekiq/throttled/communicator/listener.rb +4 -4
- data/lib/sidekiq/throttled/communicator.rb +1 -1
- data/lib/sidekiq/throttled/expirable_list.rb +2 -5
- data/lib/sidekiq/throttled/fetch/unit_of_work.rb +7 -2
- data/lib/sidekiq/throttled/fetch.rb +5 -1
- data/lib/sidekiq/throttled/job.rb +128 -0
- data/lib/sidekiq/throttled/queue_name.rb +1 -1
- data/lib/sidekiq/throttled/registry.rb +0 -5
- data/lib/sidekiq/throttled/strategy.rb +15 -17
- data/lib/sidekiq/throttled/strategy_collection.rb +69 -0
- data/lib/sidekiq/throttled/utils.rb +1 -1
- data/lib/sidekiq/throttled/version.rb +1 -1
- data/lib/sidekiq/throttled/web/stats.rb +5 -4
- data/lib/sidekiq/throttled/web/summary_fix.rb +1 -1
- data/lib/sidekiq/throttled/web/throttled.html.erb +6 -2
- data/lib/sidekiq/throttled/web.rb +1 -1
- data/lib/sidekiq/throttled/worker.rb +6 -121
- data/lib/sidekiq/throttled.rb +5 -3
- data/rubocop/layout.yml +24 -0
- data/rubocop/lint.yml +41 -0
- data/rubocop/metrics.yml +4 -0
- data/rubocop/performance.yml +25 -0
- data/rubocop/rspec.yml +3 -0
- data/rubocop/style.yml +84 -0
- data/sidekiq-throttled.gemspec +8 -4
- metadata +27 -16
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 149c9477c7a02b5a8a48fd0f9d1a665c1cd254a2b5af92c82bb0bbcda92c7907
         | 
| 4 | 
            +
              data.tar.gz: 2fe05d0217edbdb5e9a66fdbd29149824ba5623d5c2e5d5df2db269d4a003bfc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 165176da74bbeaa33d3f882c8cac2f61e1796184dfcfedb737a9604d49cad86d20c1a9b7a19c8272a7302164825036bcea3a0a2dc78c0312db7dd1ac19f5c64a
         | 
| 7 | 
            +
              data.tar.gz: 6db474ddc907ee5c97d3b9eb829a338c9a28d5997346031864cbfcda00857a24b49ae36451f92bf112d0985065bbf72443313733bc13075c8e1ebdcab6465c70
         | 
    
        data/.github/workflows/ci.yml
    CHANGED
    
    | @@ -2,20 +2,19 @@ name: CI | |
| 2 2 |  | 
| 3 3 | 
             
            on:
         | 
| 4 4 | 
             
              push:
         | 
| 5 | 
            -
                branches: [  | 
| 5 | 
            +
                branches: [ main ]
         | 
| 6 6 | 
             
              pull_request:
         | 
| 7 | 
            -
                branches: [  | 
| 7 | 
            +
                branches: [ main ]
         | 
| 8 8 |  | 
| 9 9 | 
             
            jobs:
         | 
| 10 | 
            -
               | 
| 10 | 
            +
              test:
         | 
| 11 11 | 
             
                name: "rspec (ruby:${{ matrix.ruby }} sidekiq:${{ matrix.sidekiq }})"
         | 
| 12 12 |  | 
| 13 13 | 
             
                strategy:
         | 
| 14 | 
            +
                  fail-fast: false
         | 
| 14 15 | 
             
                  matrix:
         | 
| 15 | 
            -
                    ruby: [ "2. | 
| 16 | 
            -
                    sidekiq: [ " | 
| 17 | 
            -
                    exclude:
         | 
| 18 | 
            -
                      - { ruby: "2.4", sidekiq: "6.0" }
         | 
| 16 | 
            +
                    ruby: [ "2.7", "3.0", "3.1" ]
         | 
| 17 | 
            +
                    sidekiq: [ "6.0", "6.1", "6.2", "6.3", "6.4", "6.5" ]
         | 
| 19 18 |  | 
| 20 19 | 
             
                runs-on: ubuntu-latest
         | 
| 21 20 |  | 
| @@ -26,7 +25,7 @@ jobs: | |
| 26 25 | 
             
                    options: "--entrypoint redis-server"
         | 
| 27 26 |  | 
| 28 27 | 
             
                env:
         | 
| 29 | 
            -
                   | 
| 28 | 
            +
                  BUNDLE_GEMFILE: gemfiles/sidekiq_${{ matrix.sidekiq }}.gemfile
         | 
| 30 29 |  | 
| 31 30 | 
             
                steps:
         | 
| 32 31 | 
             
                  - uses: actions/checkout@v2
         | 
| @@ -34,11 +33,10 @@ jobs: | |
| 34 33 | 
             
                  - uses: ruby/setup-ruby@v1
         | 
| 35 34 | 
             
                    with:
         | 
| 36 35 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 36 | 
            +
                      bundler-cache: true
         | 
| 37 37 |  | 
| 38 | 
            -
                  - name: bundle  | 
| 39 | 
            -
                    run: bundle  | 
| 40 | 
            -
             | 
| 41 | 
            -
                  - run: bundle exec rspec
         | 
| 38 | 
            +
                  - name: bundle exec rspec
         | 
| 39 | 
            +
                    run: bundle exec rspec --format progress --force-colour
         | 
| 42 40 |  | 
| 43 41 | 
             
              rubocop:
         | 
| 44 42 | 
             
                runs-on: ubuntu-latest
         | 
| @@ -48,9 +46,7 @@ jobs: | |
| 48 46 |  | 
| 49 47 | 
             
                  - uses: ruby/setup-ruby@v1
         | 
| 50 48 | 
             
                    with:
         | 
| 51 | 
            -
                      ruby-version: "2. | 
| 52 | 
            -
             | 
| 53 | 
            -
                  - name: bundle install
         | 
| 54 | 
            -
                    run: bundle install --without development --jobs 4 --retry 3
         | 
| 49 | 
            +
                      ruby-version: "2.7"
         | 
| 50 | 
            +
                      bundler-cache: true
         | 
| 55 51 |  | 
| 56 52 | 
             
                  - run: bundle exec rubocop
         | 
    
        data/.rubocop.yml
    CHANGED
    
    | @@ -1,100 +1,20 @@ | |
| 1 | 
            -
            inherit_from:
         | 
| 2 | 
            -
              - .rubocop_todo.yml
         | 
| 3 | 
            -
             | 
| 4 1 | 
             
            require:
         | 
| 2 | 
            +
              - rubocop-performance
         | 
| 3 | 
            +
              - rubocop-rake
         | 
| 5 4 | 
             
              - rubocop-rspec
         | 
| 6 5 |  | 
| 7 | 
            -
             | 
| 6 | 
            +
            inherit_from:
         | 
| 7 | 
            +
              - .rubocop_todo.yml
         | 
| 8 | 
            +
              - rubocop/layout.yml
         | 
| 9 | 
            +
              - rubocop/lint.yml
         | 
| 10 | 
            +
              - rubocop/metrics.yml
         | 
| 11 | 
            +
              - rubocop/performance.yml
         | 
| 12 | 
            +
              - rubocop/rspec.yml
         | 
| 13 | 
            +
              - rubocop/style.yml
         | 
| 8 14 |  | 
| 9 15 | 
             
            AllCops:
         | 
| 10 | 
            -
              DisplayCopNames: true
         | 
| 11 | 
            -
              TargetRubyVersion: 2.4
         | 
| 12 16 | 
             
              Exclude:
         | 
| 13 | 
            -
                -  | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            Layout/ArgumentAlignment:
         | 
| 18 | 
            -
              EnforcedStyle: with_fixed_indentation
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            Layout/FirstArrayElementIndentation:
         | 
| 21 | 
            -
              EnforcedStyle: consistent
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            Layout/FirstHashElementIndentation:
         | 
| 24 | 
            -
              EnforcedStyle: consistent
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            Layout/HashAlignment:
         | 
| 27 | 
            -
              EnforcedHashRocketStyle: table
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            Layout/LineLength:
         | 
| 30 | 
            -
              Max: 100
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            Layout/MultilineMethodCallIndentation:
         | 
| 33 | 
            -
              EnforcedStyle: indented
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            Layout/ParameterAlignment:
         | 
| 36 | 
            -
              EnforcedStyle: with_fixed_indentation
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            Layout/SpaceAroundMethodCallOperator:
         | 
| 39 | 
            -
              Enabled: true
         | 
| 40 | 
            -
             | 
| 41 | 
            -
            Layout/SpaceInLambdaLiteral:
         | 
| 42 | 
            -
              EnforcedStyle: require_space
         | 
| 43 | 
            -
             | 
| 44 | 
            -
            ## Lint ########################################################################
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            Lint/RaiseException:
         | 
| 47 | 
            -
              Enabled: true
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            Lint/StructNewOverride:
         | 
| 50 | 
            -
              Enabled: true
         | 
| 51 | 
            -
             | 
| 52 | 
            -
            ## Metrics #####################################################################
         | 
| 53 | 
            -
             | 
| 54 | 
            -
            Metrics/BlockLength:
         | 
| 55 | 
            -
              Exclude:
         | 
| 56 | 
            -
                - "Guardfile"
         | 
| 57 | 
            -
                - "spec/**/*"
         | 
| 58 | 
            -
             | 
| 59 | 
            -
            ## Styles ######################################################################
         | 
| 60 | 
            -
             | 
| 61 | 
            -
            Style/Documentation:
         | 
| 62 | 
            -
              Enabled: false
         | 
| 63 | 
            -
             | 
| 64 | 
            -
            Style/ExponentialNotation:
         | 
| 65 | 
            -
              Enabled: true
         | 
| 66 | 
            -
             | 
| 67 | 
            -
            Style/HashEachMethods:
         | 
| 68 | 
            -
              Enabled: true
         | 
| 69 | 
            -
             | 
| 70 | 
            -
            Style/HashSyntax:
         | 
| 71 | 
            -
              EnforcedStyle: hash_rockets
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            Style/HashTransformKeys:
         | 
| 74 | 
            -
              Enabled: true
         | 
| 75 | 
            -
             | 
| 76 | 
            -
            Style/HashTransformValues:
         | 
| 77 | 
            -
              Enabled: true
         | 
| 78 | 
            -
             | 
| 79 | 
            -
            # Follow your heart where it makes sense to use lambda or lambda literal.
         | 
| 80 | 
            -
            # Enforcing it makes some pieces of code look REALLY terrible, e.g. in
         | 
| 81 | 
            -
            # case of empty (noop) lambdas: `lambda { |_| }`.
         | 
| 82 | 
            -
            Style/Lambda:
         | 
| 83 | 
            -
              Enabled: false
         | 
| 84 | 
            -
             | 
| 85 | 
            -
            # Enabling this cop makes Guardfile (which is full of pathname regexps)
         | 
| 86 | 
            -
            # look absolutley style-inconsistent and terrible. In any case, this should
         | 
| 87 | 
            -
            # be on developer's choice whenever to use `%r` or not. Just like we don't
         | 
| 88 | 
            -
            # enforce to use `["foo"]` over `%w(foo)` and so on.
         | 
| 89 | 
            -
            Style/RegexpLiteral:
         | 
| 90 | 
            -
              Enabled: false
         | 
| 91 | 
            -
             | 
| 92 | 
            -
            Style/RescueStandardError:
         | 
| 93 | 
            -
              EnforcedStyle: implicit
         | 
| 94 | 
            -
             | 
| 95 | 
            -
            Style/StringLiterals:
         | 
| 96 | 
            -
              EnforcedStyle: double_quotes
         | 
| 97 | 
            -
             | 
| 98 | 
            -
            # I prefer Yoda style instead, but there's no such enforcement style.
         | 
| 99 | 
            -
            Style/YodaCondition:
         | 
| 100 | 
            -
              Enabled: false
         | 
| 17 | 
            +
                - gemfiles/**/*
         | 
| 18 | 
            +
                - vendor/**/*
         | 
| 19 | 
            +
              NewCops: enable
         | 
| 20 | 
            +
              TargetRubyVersion: 2.7
         | 
    
        data/.rubocop_todo.yml
    CHANGED
    
    | @@ -1,57 +1,68 @@ | |
| 1 1 | 
             
            # This configuration was generated by
         | 
| 2 2 | 
             
            # `rubocop --auto-gen-config`
         | 
| 3 | 
            -
            # on  | 
| 3 | 
            +
            # on 2022-06-13 00:11:28 UTC using RuboCop version 1.30.1.
         | 
| 4 4 | 
             
            # The point is for the user to remove these configuration records
         | 
| 5 5 | 
             
            # one by one as the offenses are removed from the code base.
         | 
| 6 6 | 
             
            # Note that changes in the inspected code, or installation of new
         | 
| 7 7 | 
             
            # versions of RuboCop, may require this file to be generated again.
         | 
| 8 8 |  | 
| 9 | 
            -
            # Offense count:  | 
| 10 | 
            -
            # Configuration parameters:  | 
| 11 | 
            -
             | 
| 12 | 
            -
               | 
| 9 | 
            +
            # Offense count: 3
         | 
| 10 | 
            +
            # Configuration parameters: AllowComments, AllowEmptyLambdas.
         | 
| 11 | 
            +
            Lint/EmptyBlock:
         | 
| 12 | 
            +
              Exclude:
         | 
| 13 | 
            +
                - 'spec/sidekiq/throttled/middleware_spec.rb'
         | 
| 14 | 
            +
                - 'spec/sidekiq/throttled/registry_spec.rb'
         | 
| 13 15 |  | 
| 14 | 
            -
            # Offense count:  | 
| 15 | 
            -
            # Configuration parameters:  | 
| 16 | 
            -
             | 
| 16 | 
            +
            # Offense count: 2
         | 
| 17 | 
            +
            # Configuration parameters: EnforcedStyleForLeadingUnderscores.
         | 
| 18 | 
            +
            # SupportedStylesForLeadingUnderscores: disallowed, required, optional
         | 
| 19 | 
            +
            Naming/MemoizedInstanceVariableName:
         | 
| 20 | 
            +
              Exclude:
         | 
| 21 | 
            +
                - 'lib/sidekiq/throttled/communicator.rb'
         | 
| 22 | 
            +
                - 'lib/sidekiq/throttled/queues_pauser.rb'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            # Offense count: 2
         | 
| 25 | 
            +
            Performance/MethodObjectAsBlock:
         | 
| 26 | 
            +
              Exclude:
         | 
| 27 | 
            +
                - 'lib/sidekiq/throttled/queues_pauser.rb'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            # Offense count: 2
         | 
| 30 | 
            +
            # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
         | 
| 31 | 
            +
            # Include: **/*_spec*rb*, **/spec/**/*
         | 
| 32 | 
            +
            RSpec/FilePath:
         | 
| 17 33 | 
             
              Exclude:
         | 
| 18 | 
            -
                - 'spec/sidekiq/throttled/communicator/callbacks_spec.rb'
         | 
| 19 | 
            -
                - 'spec/sidekiq/throttled/communicator/listener_spec.rb'
         | 
| 20 | 
            -
                - 'spec/sidekiq/throttled/communicator_spec.rb'
         | 
| 21 | 
            -
                - 'spec/sidekiq/throttled/fetch_spec.rb'
         | 
| 22 | 
            -
                - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
         | 
| 23 | 
            -
                - 'spec/sidekiq/throttled/strategy_spec.rb'
         | 
| 24 34 | 
             
                - 'spec/sidekiq/throttled/web/queues_spec.rb'
         | 
| 25 | 
            -
                - 'spec/sidekiq/throttled_spec.rb'
         | 
| 35 | 
            +
                - 'spec/sidekiq/throttled/web/throttled_spec.rb'
         | 
| 26 36 |  | 
| 27 | 
            -
            # Offense count:  | 
| 37 | 
            +
            # Offense count: 69
         | 
| 28 38 | 
             
            # Configuration parameters: .
         | 
| 29 39 | 
             
            # SupportedStyles: have_received, receive
         | 
| 30 40 | 
             
            RSpec/MessageSpies:
         | 
| 31 41 | 
             
              EnforcedStyle: receive
         | 
| 32 42 |  | 
| 33 | 
            -
            # Offense count:  | 
| 34 | 
            -
            # Configuration parameters: AggregateFailuresByDefault.
         | 
| 43 | 
            +
            # Offense count: 22
         | 
| 35 44 | 
             
            RSpec/MultipleExpectations:
         | 
| 36 45 | 
             
              Max: 4
         | 
| 37 46 |  | 
| 38 | 
            -
            # Offense count:  | 
| 47 | 
            +
            # Offense count: 7
         | 
| 48 | 
            +
            # Configuration parameters: AllowSubject.
         | 
| 49 | 
            +
            RSpec/MultipleMemoizedHelpers:
         | 
| 50 | 
            +
              Max: 6
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # Offense count: 46
         | 
| 39 53 | 
             
            RSpec/NestedGroups:
         | 
| 40 54 | 
             
              Max: 5
         | 
| 41 55 |  | 
| 42 | 
            -
            # Offense count:  | 
| 43 | 
            -
            RSpec/ | 
| 56 | 
            +
            # Offense count: 5
         | 
| 57 | 
            +
            RSpec/StubbedMock:
         | 
| 44 58 | 
             
              Exclude:
         | 
| 45 | 
            -
                - 'spec/sidekiq/throttled/ | 
| 59 | 
            +
                - 'spec/sidekiq/throttled/expirable_list_spec.rb'
         | 
| 60 | 
            +
                - 'spec/sidekiq/throttled/fetch_spec.rb'
         | 
| 46 61 | 
             
                - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
         | 
| 47 62 |  | 
| 48 | 
            -
            # Offense count:  | 
| 49 | 
            -
             | 
| 50 | 
            -
            RSpec/VerifiedDoubles:
         | 
| 51 | 
            -
              Exclude:
         | 
| 52 | 
            -
                - 'spec/sidekiq/throttled/registry_spec.rb'
         | 
| 53 | 
            -
             | 
| 54 | 
            -
            # Offense count: 1
         | 
| 55 | 
            -
            Security/MarshalLoad:
         | 
| 63 | 
            +
            # Offense count: 6
         | 
| 64 | 
            +
            RSpec/SubjectStub:
         | 
| 56 65 | 
             
              Exclude:
         | 
| 57 | 
            -
                - ' | 
| 66 | 
            +
                - 'spec/sidekiq/throttled/communicator_spec.rb'
         | 
| 67 | 
            +
                - 'spec/sidekiq/throttled/fetch_spec.rb'
         | 
| 68 | 
            +
                - 'spec/sidekiq/throttled/queues_pauser_spec.rb'
         | 
    
        data/Appraisals
    CHANGED
    
    | @@ -1,21 +1,25 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            appraise "sidekiq- | 
| 4 | 
            -
              gem "sidekiq", "~>  | 
| 3 | 
            +
            appraise "sidekiq-6.0" do
         | 
| 4 | 
            +
              gem "sidekiq", "~> 6.0.0"
         | 
| 5 5 | 
             
            end
         | 
| 6 6 |  | 
| 7 | 
            -
            appraise "sidekiq- | 
| 8 | 
            -
              gem "sidekiq", "~>  | 
| 7 | 
            +
            appraise "sidekiq-6.1" do
         | 
| 8 | 
            +
              gem "sidekiq", "~> 6.1.0"
         | 
| 9 9 | 
             
            end
         | 
| 10 10 |  | 
| 11 | 
            -
            appraise "sidekiq- | 
| 12 | 
            -
              gem "sidekiq", "~>  | 
| 11 | 
            +
            appraise "sidekiq-6.2" do
         | 
| 12 | 
            +
              gem "sidekiq", "~> 6.2.0"
         | 
| 13 13 | 
             
            end
         | 
| 14 14 |  | 
| 15 | 
            -
            appraise "sidekiq-6. | 
| 16 | 
            -
              gem "sidekiq", "~> 6. | 
| 15 | 
            +
            appraise "sidekiq-6.3" do
         | 
| 16 | 
            +
              gem "sidekiq", "~> 6.3.0"
         | 
| 17 17 | 
             
            end
         | 
| 18 18 |  | 
| 19 | 
            -
            appraise "sidekiq-6. | 
| 20 | 
            -
              gem "sidekiq", "~> 6. | 
| 19 | 
            +
            appraise "sidekiq-6.4" do
         | 
| 20 | 
            +
              gem "sidekiq", "~> 6.4.0"
         | 
| 21 | 
            +
            end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            appraise "sidekiq-6.5" do
         | 
| 24 | 
            +
              gem "sidekiq", "~> 6.5.0"
         | 
| 21 25 | 
             
            end
         | 
    
        data/CHANGES.md
    CHANGED
    
    | @@ -1,3 +1,56 @@ | |
| 1 | 
            +
            ## 0.16.0 (2022-06-13)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Drop Ruby 2.6 support.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Drop Sidekiq 5.X support.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * [#121](https://github.com/sensortower/sidekiq-throttled/pull/121)
         | 
| 8 | 
            +
              Sidekiq 6.5 compatibility.
         | 
| 9 | 
            +
              ([@hieuk09])
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            * [#116](https://github.com/sensortower/sidekiq-throttled/pull/116)
         | 
| 12 | 
            +
              Unwrap ActiveJob JobWrapper
         | 
| 13 | 
            +
              ([@holstvoogd])
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            * [#115](https://github.com/sensortower/sidekiq-throttled/pull/115)
         | 
| 16 | 
            +
              Fix Redis 4.6 deprecation warnings.
         | 
| 17 | 
            +
              ([@dbackeus])
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            * [#113](https://github.com/sensortower/sidekiq-throttled/pull/113)
         | 
| 20 | 
            +
              Add Ruby 3.1 to CI.
         | 
| 21 | 
            +
              ([@petergoldstein])
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            * [#103](https://github.com/sensortower/sidekiq-throttled/pull/103)
         | 
| 24 | 
            +
              Rename Sidekiq::Throttled::Worker to Sidekiq::Throttled::Job, and alias it
         | 
| 25 | 
            +
              as Sidekiq::Throttled::Worker.
         | 
| 26 | 
            +
              ([@CHTJonas])
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            ## 0.15.0 (2021-12-16)
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            * [#102](https://github.com/sensortower/sidekiq-throttled/pull/102)
         | 
| 31 | 
            +
              Support Ruby 3.0 and Sidekiq 6.2+.
         | 
| 32 | 
            +
              ([@ybiquitous])
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            * [#97](https://github.com/sensortower/sidekiq-throttled/pull/97)
         | 
| 35 | 
            +
              Fix kwargs usage in strategy collection.
         | 
| 36 | 
            +
              ([@baptistejub])
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            ## 0.14.0 (2021-09-21)
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            * [#98](https://github.com/sensortower/sidekiq-throttled/pull/98)
         | 
| 41 | 
            +
              Remove warning for strategy override.
         | 
| 42 | 
            +
              ([@mattiagiuffrida-st])
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            * [#65](https://github.com/sensortower/sidekiq-throttled/pull/65)
         | 
| 45 | 
            +
              Support composite (multi-key) strategies.
         | 
| 46 | 
            +
              ([@holyketzer])
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            * [#89](https://github.com/sensortower/sidekiq-throttled/pull/89),
         | 
| 49 | 
            +
              [#96](https://github.com/sensortower/sidekiq-throttled/pull/96), and
         | 
| 50 | 
            +
              [#93](https://github.com/sensortower/sidekiq-throttled/pull/93)
         | 
| 51 | 
            +
              Improve documentation.
         | 
| 52 | 
            +
              ([@hubertjakubiak], [@khaile], and [@kylerippey])
         | 
| 53 | 
            +
             | 
| 1 54 | 
             
            ## 0.13.0 (2020-07-28)
         | 
| 2 55 |  | 
| 3 56 | 
             
            * [#85](https://github.com/sensortower/sidekiq-throttled/pull/85)
         | 
| @@ -221,3 +274,15 @@ | |
| 221 274 | 
             
            [@lenon]: https://github.com/lenon
         | 
| 222 275 | 
             
            [@vaot]: https://github.com/vaot
         | 
| 223 276 | 
             
            [@hmaack]: https://github.com/hmaack
         | 
| 277 | 
            +
            [@holyketzer]: https://github.com/holyketzer
         | 
| 278 | 
            +
            [@hubertjakubiak]: https://github.com/hubertjakubiak
         | 
| 279 | 
            +
            [@kylerippey]: https://github.com/kylerippey
         | 
| 280 | 
            +
            [@khaile]: https://github.com/khaile
         | 
| 281 | 
            +
            [@mattiagiuffrida-st]: https://github.com/mattiagiuffrida-st
         | 
| 282 | 
            +
            [@baptistejub]: https://github.com/baptistejub
         | 
| 283 | 
            +
            [@ybiquitous]: https://github.com/ybiquitous
         | 
| 284 | 
            +
            [@hieuk09]: https://github.com/hieuk09
         | 
| 285 | 
            +
            [@petergoldstein]: https://github.com/petergoldstein
         | 
| 286 | 
            +
            [@dbackeus]: https://github.com/dbackeus
         | 
| 287 | 
            +
            [@holstvoogd]: https://github.com/holstvoogd
         | 
| 288 | 
            +
            [@CHTJonas]: https://github.com/CHTJonas
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -5,9 +5,6 @@ source "https://rubygems.org" | |
| 5 5 | 
             
            gem "appraisal"
         | 
| 6 6 | 
             
            gem "rake"
         | 
| 7 7 | 
             
            gem "rspec"
         | 
| 8 | 
            -
            gem "rubocop",             "~> 0.82.0", :require => false
         | 
| 9 | 
            -
            gem "rubocop-performance", "~>1.5.2",   :require => false
         | 
| 10 | 
            -
            gem "rubocop-rspec",       "~> 1.39.0", :require => false
         | 
| 11 8 | 
             
            gem "sidekiq"
         | 
| 12 9 |  | 
| 13 10 | 
             
            group :development do
         | 
| @@ -20,13 +17,18 @@ end | |
| 20 17 | 
             
            group :test do
         | 
| 21 18 | 
             
              gem "apparition"
         | 
| 22 19 | 
             
              gem "capybara"
         | 
| 23 | 
            -
              gem "coveralls", :require => false
         | 
| 24 20 | 
             
              gem "puma"
         | 
| 25 21 | 
             
              gem "rack-test"
         | 
| 26 | 
            -
              gem "simplecov"
         | 
| 27 22 | 
             
              gem "sinatra"
         | 
| 28 23 | 
             
              gem "timecop"
         | 
| 29 24 | 
             
            end
         | 
| 30 25 |  | 
| 26 | 
            +
            group :lint do
         | 
| 27 | 
            +
              gem "rubocop",              :require => false
         | 
| 28 | 
            +
              gem "rubocop-performance",  :require => false
         | 
| 29 | 
            +
              gem "rubocop-rake",         :require => false
         | 
| 30 | 
            +
              gem "rubocop-rspec",        :require => false
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 31 33 | 
             
            # Specify your gem's dependencies in sidekiq-throttled.gemspec
         | 
| 32 34 | 
             
            gemspec
         | 
    
        data/LICENSE.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,10 +1,7 @@ | |
| 1 1 | 
             
            # Sidekiq::Throttled
         | 
| 2 2 |  | 
| 3 | 
            +
            [](https://github.com/ixti/sidekiq-throttled/actions/workflows/ci.yml)
         | 
| 3 4 | 
             
            [](http://rubygems.org/gems/sidekiq-throttled)
         | 
| 4 | 
            -
            [](https://github.com/sensortower/sidekiq-throttled/actions?query=workflow%3ACI+branch%3Amaster)
         | 
| 5 | 
            -
            [](https://codeclimate.com/github/sensortower/sidekiq-throttled)
         | 
| 6 | 
            -
            [](https://coveralls.io/github/sensortower/sidekiq-throttled?branch=master)
         | 
| 7 | 
            -
            [](http://inch-ci.org/github/sensortower/sidekiq-throttled)
         | 
| 8 5 | 
             
            [](http://www.rubydoc.info/gems/sidekiq-throttled)
         | 
| 9 6 |  | 
| 10 7 | 
             
            Concurrency and threshold throttling for [Sidekiq][sidekiq].
         | 
| @@ -49,12 +46,12 @@ class MyWorker | |
| 49 46 |  | 
| 50 47 | 
             
              sidekiq_options :queue => :my_queue
         | 
| 51 48 |  | 
| 52 | 
            -
              sidekiq_throttle( | 
| 49 | 
            +
              sidekiq_throttle(
         | 
| 53 50 | 
             
                # Allow maximum 10 concurrent jobs of this class at a time.
         | 
| 54 51 | 
             
                :concurrency => { :limit => 10 },
         | 
| 55 52 | 
             
                # Allow maximum 1K jobs being processed within one hour window.
         | 
| 56 53 | 
             
                :threshold => { :limit => 1_000, :period => 1.hour }
         | 
| 57 | 
            -
               | 
| 54 | 
            +
              )
         | 
| 58 55 |  | 
| 59 56 | 
             
              def perform
         | 
| 60 57 | 
             
                # ...
         | 
| @@ -78,11 +75,11 @@ class MyWorker | |
| 78 75 |  | 
| 79 76 | 
             
              sidekiq_options :queue => :my_queue
         | 
| 80 77 |  | 
| 81 | 
            -
              sidekiq_throttle( | 
| 78 | 
            +
              sidekiq_throttle(
         | 
| 82 79 | 
             
                :concurrency => { :limit => 10 },
         | 
| 83 80 | 
             
                :threshold   => { :limit => 100, :period => 1.hour }
         | 
| 84 81 | 
             
                :observer    => MY_OBSERVER
         | 
| 85 | 
            -
               | 
| 82 | 
            +
              )
         | 
| 86 83 |  | 
| 87 84 | 
             
              def perform(*args)
         | 
| 88 85 | 
             
                # ...
         | 
| @@ -106,10 +103,10 @@ class MyWorker | |
| 106 103 |  | 
| 107 104 | 
             
              sidekiq_options :queue => :my_queue
         | 
| 108 105 |  | 
| 109 | 
            -
              sidekiq_throttle( | 
| 106 | 
            +
              sidekiq_throttle(
         | 
| 110 107 | 
             
                # Allow maximum 10 concurrent jobs per user at a time.
         | 
| 111 108 | 
             
                :concurrency => { :limit => 10, :key_suffix => -> (user_id) { user_id } }
         | 
| 112 | 
            -
               | 
| 109 | 
            +
              )
         | 
| 113 110 |  | 
| 114 111 | 
             
              def perform(user_id)
         | 
| 115 112 | 
             
                # ...
         | 
| @@ -128,7 +125,7 @@ class MyWorker | |
| 128 125 |  | 
| 129 126 | 
             
              sidekiq_options :queue => :my_queue
         | 
| 130 127 |  | 
| 131 | 
            -
              sidekiq_throttle( | 
| 128 | 
            +
              sidekiq_throttle(
         | 
| 132 129 | 
             
                # Allow maximum 1000 concurrent jobs of this class at a time for VIPs and 10 for all other users.
         | 
| 133 130 | 
             
                :concurrency => {
         | 
| 134 131 | 
             
                  :limit      => ->(user_id) { User.vip?(user_id) ? 1_000 : 10 },
         | 
| @@ -139,7 +136,7 @@ class MyWorker | |
| 139 136 | 
             
                  :limit      => ->(user_id) { User.vip?(user_id) ? 1_000 : 10 },
         | 
| 140 137 | 
             
                  :period     => ->(user_id) { User.vip?(user_id) ? 1.hour : 1.day },
         | 
| 141 138 | 
             
                  :key_suffix => ->(user_id) { User.vip?(user_id) ? "vip" : "std" }
         | 
| 142 | 
            -
               | 
| 139 | 
            +
              )
         | 
| 143 140 |  | 
| 144 141 | 
             
              def perform(user_id)
         | 
| 145 142 | 
             
                # ...
         | 
| @@ -147,6 +144,30 @@ class MyWorker | |
| 147 144 | 
             
            end
         | 
| 148 145 | 
             
            ```
         | 
| 149 146 |  | 
| 147 | 
            +
            You also can use several different keys to throttle one worker.
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            ``` ruby
         | 
| 150 | 
            +
            class MyWorker
         | 
| 151 | 
            +
              include Sidekiq::Worker
         | 
| 152 | 
            +
              include Sidekiq::Throttled::Worker
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              sidekiq_options :queue => :my_queue
         | 
| 155 | 
            +
             | 
| 156 | 
            +
              sidekiq_throttle(
         | 
| 157 | 
            +
                # Allow maximum 10 concurrent jobs per project at a time and maximum 2 jobs per user
         | 
| 158 | 
            +
                :concurrency => [
         | 
| 159 | 
            +
                  { :limit => 10, :key_suffix => -> (project_id, user_id) { project_id } },
         | 
| 160 | 
            +
                  { :limit => 2, :key_suffix => -> (project_id, user_id) { user_id } }
         | 
| 161 | 
            +
                ]
         | 
| 162 | 
            +
                # For :threshold it works the same
         | 
| 163 | 
            +
              )
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              def perform(project_id, user_id)
         | 
| 166 | 
            +
                # ...
         | 
| 167 | 
            +
              end
         | 
| 168 | 
            +
            end
         | 
| 169 | 
            +
            ```
         | 
| 170 | 
            +
             | 
| 150 171 | 
             
            **NB** Don't forget to specify `:key_suffix` and make it return different values
         | 
| 151 172 | 
             
            if you are using dynamic limit/period options. Otherwise you risk getting into
         | 
| 152 173 | 
             
            some trouble.
         | 
| @@ -206,12 +227,12 @@ end | |
| 206 227 |  | 
| 207 228 | 
             
            ## Supported Ruby Versions
         | 
| 208 229 |  | 
| 209 | 
            -
            This library aims to support and is [tested against][ | 
| 230 | 
            +
            This library aims to support and is [tested against][ci] the following Ruby
         | 
| 210 231 | 
             
            versions:
         | 
| 211 232 |  | 
| 212 | 
            -
            * Ruby 2. | 
| 213 | 
            -
            * Ruby  | 
| 214 | 
            -
            * Ruby  | 
| 233 | 
            +
            * Ruby 2.7.x
         | 
| 234 | 
            +
            * Ruby 3.0.x
         | 
| 235 | 
            +
            * Ruby 3.1.x
         | 
| 215 236 |  | 
| 216 237 | 
             
            If something doesn't work on one of these versions, it's a bug.
         | 
| 217 238 |  | 
| @@ -231,11 +252,12 @@ dropped. | |
| 231 252 |  | 
| 232 253 | 
             
            This library aims to support work with following [Sidekiq][sidekiq] versions:
         | 
| 233 254 |  | 
| 234 | 
            -
            * Sidekiq 5.0.x
         | 
| 235 | 
            -
            * Sidekiq 5.1.x
         | 
| 236 | 
            -
            * Sidekiq 5.2.x
         | 
| 237 255 | 
             
            * Sidekiq 6.0.x
         | 
| 238 256 | 
             
            * Sidekiq 6.1.x
         | 
| 257 | 
            +
            * Sidekiq 6.2.x
         | 
| 258 | 
            +
            * Sidekiq 6.3.x
         | 
| 259 | 
            +
            * Sidekiq 6.4.x
         | 
| 260 | 
            +
            * Sidekiq 6.5.x
         | 
| 239 261 |  | 
| 240 262 |  | 
| 241 263 | 
             
            ## Contributing
         | 
| @@ -261,11 +283,5 @@ bundle exec rubocop             # run static code analysis | |
| 261 283 | 
             
            Don't forget to run `appraisal update` after any changes to `Gemfile`.
         | 
| 262 284 |  | 
| 263 285 |  | 
| 264 | 
            -
             | 
| 265 | 
            -
             | 
| 266 | 
            -
            Copyright (c) 2015-2020 SensorTower Inc.
         | 
| 267 | 
            -
            See LICENSE.md for further details.
         | 
| 268 | 
            -
             | 
| 269 | 
            -
             | 
| 270 | 
            -
            [travis]: http://travis-ci.org/sensortower/sidekiq-throttled
         | 
| 286 | 
            +
            [ci]: https://github.com/ixti/sidekiq-throttled/actions/workflows/ci.yml
         | 
| 271 287 | 
             
            [sidekiq]: https://github.com/mperham/sidekiq
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -24,4 +24,4 @@ end | |
| 24 24 | 
             
            default_suite = ENV["CI"] ? :spec : %i[spec rubocop]
         | 
| 25 25 | 
             
            named_suites  = { "rubocop" => :rubocop, "rspec" => :spec }
         | 
| 26 26 |  | 
| 27 | 
            -
            task :default => named_suites.fetch(ENV | 
| 27 | 
            +
            task :default => named_suites.fetch(ENV.fetch("SUITE", nil), default_suite)
         | 
| @@ -5,9 +5,6 @@ source "https://rubygems.org" | |
| 5 5 | 
             
            gem "appraisal"
         | 
| 6 6 | 
             
            gem "rake"
         | 
| 7 7 | 
             
            gem "rspec"
         | 
| 8 | 
            -
            gem "rubocop", "~> 0.82.0", require: false
         | 
| 9 | 
            -
            gem "rubocop-performance", "~>1.5.2", require: false
         | 
| 10 | 
            -
            gem "rubocop-rspec", "~> 1.39.0", require: false
         | 
| 11 8 | 
             
            gem "sidekiq", "~> 6.0.0"
         | 
| 12 9 |  | 
| 13 10 | 
             
            group :development do
         | 
| @@ -20,12 +17,17 @@ end | |
| 20 17 | 
             
            group :test do
         | 
| 21 18 | 
             
              gem "apparition"
         | 
| 22 19 | 
             
              gem "capybara"
         | 
| 23 | 
            -
              gem "coveralls", require: false
         | 
| 24 20 | 
             
              gem "puma"
         | 
| 25 21 | 
             
              gem "rack-test"
         | 
| 26 | 
            -
              gem "simplecov"
         | 
| 27 22 | 
             
              gem "sinatra"
         | 
| 28 23 | 
             
              gem "timecop"
         | 
| 29 24 | 
             
            end
         | 
| 30 25 |  | 
| 26 | 
            +
            group :lint do
         | 
| 27 | 
            +
              gem "rubocop", require: false
         | 
| 28 | 
            +
              gem "rubocop-performance", require: false
         | 
| 29 | 
            +
              gem "rubocop-rake", require: false
         | 
| 30 | 
            +
              gem "rubocop-rspec", require: false
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 31 33 | 
             
            gemspec path: "../"
         | 
| @@ -5,9 +5,6 @@ source "https://rubygems.org" | |
| 5 5 | 
             
            gem "appraisal"
         | 
| 6 6 | 
             
            gem "rake"
         | 
| 7 7 | 
             
            gem "rspec"
         | 
| 8 | 
            -
            gem "rubocop", "~> 0.82.0", require: false
         | 
| 9 | 
            -
            gem "rubocop-performance", "~>1.5.2", require: false
         | 
| 10 | 
            -
            gem "rubocop-rspec", "~> 1.39.0", require: false
         | 
| 11 8 | 
             
            gem "sidekiq", "~> 6.1.0"
         | 
| 12 9 |  | 
| 13 10 | 
             
            group :development do
         | 
| @@ -20,12 +17,17 @@ end | |
| 20 17 | 
             
            group :test do
         | 
| 21 18 | 
             
              gem "apparition"
         | 
| 22 19 | 
             
              gem "capybara"
         | 
| 23 | 
            -
              gem "coveralls", require: false
         | 
| 24 20 | 
             
              gem "puma"
         | 
| 25 21 | 
             
              gem "rack-test"
         | 
| 26 | 
            -
              gem "simplecov"
         | 
| 27 22 | 
             
              gem "sinatra"
         | 
| 28 23 | 
             
              gem "timecop"
         | 
| 29 24 | 
             
            end
         | 
| 30 25 |  | 
| 26 | 
            +
            group :lint do
         | 
| 27 | 
            +
              gem "rubocop", require: false
         | 
| 28 | 
            +
              gem "rubocop-performance", require: false
         | 
| 29 | 
            +
              gem "rubocop-rake", require: false
         | 
| 30 | 
            +
              gem "rubocop-rspec", require: false
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 31 33 | 
             
            gemspec path: "../"
         | 
| @@ -5,10 +5,7 @@ source "https://rubygems.org" | |
| 5 5 | 
             
            gem "appraisal"
         | 
| 6 6 | 
             
            gem "rake"
         | 
| 7 7 | 
             
            gem "rspec"
         | 
| 8 | 
            -
            gem " | 
| 9 | 
            -
            gem "rubocop-performance", "~>1.5.2", require: false
         | 
| 10 | 
            -
            gem "rubocop-rspec", "~> 1.39.0", require: false
         | 
| 11 | 
            -
            gem "sidekiq", "~> 5.0.0"
         | 
| 8 | 
            +
            gem "sidekiq", "~> 6.2.0"
         | 
| 12 9 |  | 
| 13 10 | 
             
            group :development do
         | 
| 14 11 | 
             
              gem "byebug"
         | 
| @@ -20,12 +17,17 @@ end | |
| 20 17 | 
             
            group :test do
         | 
| 21 18 | 
             
              gem "apparition"
         | 
| 22 19 | 
             
              gem "capybara"
         | 
| 23 | 
            -
              gem "coveralls", require: false
         | 
| 24 20 | 
             
              gem "puma"
         | 
| 25 21 | 
             
              gem "rack-test"
         | 
| 26 | 
            -
              gem "simplecov"
         | 
| 27 22 | 
             
              gem "sinatra"
         | 
| 28 23 | 
             
              gem "timecop"
         | 
| 29 24 | 
             
            end
         | 
| 30 25 |  | 
| 26 | 
            +
            group :lint do
         | 
| 27 | 
            +
              gem "rubocop", require: false
         | 
| 28 | 
            +
              gem "rubocop-performance", require: false
         | 
| 29 | 
            +
              gem "rubocop-rake", require: false
         | 
| 30 | 
            +
              gem "rubocop-rspec", require: false
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 31 33 | 
             
            gemspec path: "../"
         |