sidekiq-transaction_guard 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe8af50053f7431c866b6091475ac6c11498619b6dc443e3a6320fa54ce41e0
4
- data.tar.gz: fc14706b5ad35440b365db3065f12f5342ecf048a2a29e96a0baecff8179ea0a
3
+ metadata.gz: 5f1c8f731c16ff8a3da91b3073be50dd1544a1b17a82521b60637baaa4643421
4
+ data.tar.gz: 711cd9daff96b69e24d54a8e21803bcf85bf64e60ab813ba168d943e7092f236
5
5
  SHA512:
6
- metadata.gz: e4902e75a12e5b2ae4943cd415cbe7e4173db2304b8c431d40e49cd51b4c41a8acb5f23e0c20f8f1d2062593f559b4edb34ea479621988cc6df55f4e0a749a4f
7
- data.tar.gz: 88cbea82b257c33439955f45e49a36beba1d0b7b72de2a7f4fb74d6bfbda6cfc2c292bbfc12b6eed8d0ac0cf9f6565f46d9508aa100be29d6fc8f954230c389f
6
+ metadata.gz: ff23694280b688a5d0cdf7274408aa3640385dd4269814fb54421848c339f101b7dc865c7013dde0ff83ce6a9031810082155f3bfed727eaf9643a5b7cffdaa0
7
+ data.tar.gz: 36ad8e565e052c16e309fffa3f6e2b6fa715c8c694546b74b63d4aeee7f04224b68ebd193421a1f1f550fc8d02c8332507f0acf9583e1f074247d24eea60b3c4
data/CHANGELOG.md CHANGED
@@ -4,18 +4,28 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 1.0.3
8
+
9
+ ### Changed
10
+
11
+ - Updated Middleware to include Sidekiq::ClientMiddleware for Sidekiq 7.0 compatibility
12
+
13
+
7
14
  ## 1.0.2
8
15
 
9
16
  ### Changed
17
+
10
18
  - Updated database cleaner dependency to use database_cleaner-active_record instead of deprecated database_cleaner gem.
11
19
  - Added YARD doc param and return types.
12
20
 
13
21
  ## 1.0.1
14
22
 
15
23
  ### Added
24
+
16
25
  - Sidekiq 6.0 compatibility
17
26
 
18
27
  ## 1.0.0
19
28
 
20
29
  ### Added
30
+
21
31
  - Initial release
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
- # Sidekiq::TransactionGuard
1
+ # Sidekiq Transaction Guard
2
2
 
3
- [![Build Status](https://travis-ci.com/bdurand/sidekiq-transaction_guard.svg?branch=master)](https://travis-ci.com/bdurand/sidekiq-transaction_guard)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/17bbf5cb6eda022028fe/maintainability)](https://codeclimate.com/github/bdurand/sidekiq-transaction_guard/maintainability)
3
+ [![Continuous Integration](https://github.com/bdurand/sidekiq-transaction_guard/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/sidekiq-transaction_guard/actions/workflows/continuous_integration.yml)
4
+ [![Regression Test](https://github.com/bdurand/sidekiq-transaction_guard/actions/workflows/regression_test.yml/badge.svg)](https://github.com/bdurand/sidekiq-transaction_guard/actions/workflows/regression_test.yml)
5
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
6
+ [![Gem Version](https://badge.fury.io/rb/sidekiq-transaction_guard.svg)](https://badge.fury.io/rb/sidekiq-transaction_guard)
5
7
 
6
8
  You should never call a Sidekiq worker that relies on the state of the database from within a database transaction. You will end up with a race condition since the worker could kick off before the transaction is actually written to the database. This gem can be used to highlight where your code may be scheduling workers in an indeterminate state.
7
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -10,6 +10,10 @@ module Sidekiq
10
10
  # the default behavior set in `Sidekiq::TransactionGuard.mode` and
11
11
  # `Sidekiq::TransactionGuard.notify` respectively.
12
12
  class Middleware
13
+ if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("7.0")
14
+ include Sidekiq::ClientMiddleware
15
+ end
16
+
13
17
  def call(worker_class, job, queue, redis_pool)
14
18
  # Check if we need to log this. Also, convert worker_class to its actual class
15
19
  if in_transaction?
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/sidekiq/transaction_guard/version"
4
-
5
3
  Gem::Specification.new do |spec|
6
4
  spec.name = "sidekiq-transaction_guard"
7
- spec.version = Sidekiq::TransactionGuard::VERSION
5
+ spec.version = File.read(File.expand_path("VERSION", __dir__)).strip
8
6
  spec.authors = ["Brian Durand", "Winston Durand"]
9
7
  spec.email = ["bbdurand@gmail.com", "me@winstondurand.com"]
10
8
 
@@ -15,24 +13,25 @@ Gem::Specification.new do |spec|
15
13
  # Specify which files should be added to the gem when it is released.
16
14
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
15
  ignore_files = %w[
18
- .gitignore
19
- .travis.yml
16
+ .
20
17
  Appraisals
21
18
  Gemfile
22
19
  Gemfile.lock
23
20
  Rakefile
21
+ bin/
24
22
  gemfiles/
25
23
  spec/
26
24
  ]
27
- spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
25
+ spec.files = Dir.chdir(__dir__) do
28
26
  `git ls-files -z`.split("\x0").reject { |f| ignore_files.any? { |path| f.start_with?(path) } }
29
27
  end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+
32
29
  spec.require_paths = ["lib"]
33
30
 
34
31
  spec.required_ruby_version = ">= 2.2.2"
35
32
 
36
33
  spec.add_dependency "activerecord", ">= 4.0"
37
34
  spec.add_dependency "sidekiq", ">= 3.0"
35
+
36
+ spec.add_development_dependency "bundler"
38
37
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-transaction_guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  - Winston Durand
9
9
  autorequire:
10
- bindir: exe
10
+ bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-10 00:00:00.000000000 Z
12
+ date: 2023-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '3.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  description:
43
57
  email:
44
58
  - bbdurand@gmail.com
@@ -47,9 +61,6 @@ executables: []
47
61
  extensions: []
48
62
  extra_rdoc_files: []
49
63
  files:
50
- - ".github/dependabot.yml"
51
- - ".github/workflows/continuous_integration.yml"
52
- - ".standard.yml"
53
64
  - CHANGELOG.md
54
65
  - MIT_LICENSE.txt
55
66
  - README.md
@@ -79,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
90
  - !ruby/object:Gem::Version
80
91
  version: '0'
81
92
  requirements: []
82
- rubygems_version: 3.2.22
93
+ rubygems_version: 3.4.20
83
94
  signing_key:
84
95
  specification_version: 4
85
96
  summary: Protect from accidentally invoking Sidekiq jobs when there are open database
@@ -1,12 +0,0 @@
1
- # Dependabot update strategy
2
- version: 2
3
- updates:
4
- - package-ecosystem: bundler
5
- directory: "/"
6
- schedule:
7
- interval: weekly
8
- allow:
9
- # Automatically keep all runtime dependencies updated
10
- - dependency-name: "*"
11
- dependency-type: "production"
12
- versioning-strategy: lockfile-only
@@ -1,84 +0,0 @@
1
- name: Continuous Integration
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- - actions-*
8
- tags:
9
- - v*
10
- pull_request:
11
- branches-ignore:
12
- - actions-*
13
-
14
- env:
15
- BUNDLE_CLEAN: "true"
16
- BUNDLE_PATH: vendor/bundle
17
- BUNDLE_JOBS: 3
18
- BUNDLE_RETRY: 3
19
-
20
- jobs:
21
- build:
22
- runs-on: ubuntu-latest
23
- strategy:
24
- fail-fast: false
25
- matrix:
26
- include:
27
- - ruby: "ruby"
28
- standardrb: true
29
- - ruby: "3.2"
30
- appraisal: "activerecord_7.0"
31
- - ruby: "3.1"
32
- appraisal: "activerecord_6.1"
33
- - ruby: "2.7"
34
- appraisal: "activerecord_6.0"
35
- - ruby: "2.7"
36
- appraisal: "activerecord_5.2"
37
- - ruby: "2.6"
38
- appraisal: "activerecord_5.1"
39
- - ruby: "2.6"
40
- appraisal: "activerecord_5.0"
41
- - ruby: "2.5"
42
- appraisal: "activerecord_4.2"
43
- - ruby: "2.5"
44
- appraisal: "activerecord_4.1"
45
- - ruby: "2.5"
46
- appraisal: "activerecord_4.0"
47
- - ruby: "3.2"
48
- appraisal: "sidekiq_7"
49
- - ruby: "3.0"
50
- appraisal: "sidekiq_6"
51
- - ruby: "2.7"
52
- appraisal: "sidekiq_5"
53
- - ruby: "2.6"
54
- appraisal: "sidekiq_4"
55
- - ruby: "2.5"
56
- appraisal: "sidekiq_3"
57
- steps:
58
- - uses: actions/checkout@v2
59
- - name: Set up Ruby ${{ matrix.ruby }}
60
- uses: ruby/setup-ruby@v1
61
- with:
62
- ruby-version: "${{ matrix.ruby }}"
63
- - name: Install packages
64
- run: |
65
- sudo apt-get update
66
- sudo apt-get install libsqlite3-dev
67
- - name: Setup bundler
68
- if: matrix.bundler != ''
69
- run: |
70
- gem uninstall bundler --all
71
- gem install bundler --no-document --version ${{ matrix.bundler }}
72
- - name: Set Appraisal bundle
73
- if: matrix.appraisal != ''
74
- run: |
75
- echo "using gemfile gemfiles/${{ matrix.appraisal }}.gemfile"
76
- bundle config set gemfile "gemfiles/${{ matrix.appraisal }}.gemfile"
77
- - name: Install gems
78
- run: |
79
- bundle update
80
- - name: Run Tests
81
- run: bundle exec rake
82
- - name: standardrb
83
- if: matrix.standardrb == true
84
- run: bundle exec rake standard
data/.standard.yml DELETED
@@ -1,9 +0,0 @@
1
- format: progress
2
-
3
- ruby_version: 2.5
4
-
5
- ignore:
6
- - 'spec/**/*':
7
- - Lint/ConstantDefinitionInBlock
8
- - Lint/UselessAssignment
9
-