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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +5 -3
- data/VERSION +1 -1
- data/lib/sidekiq/transaction_guard/middleware.rb +4 -0
- data/sidekiq-transaction_guard.gemspec +7 -8
- metadata +18 -7
- data/.github/dependabot.yml +0 -12
- data/.github/workflows/continuous_integration.yml +0 -84
- data/.standard.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f1c8f731c16ff8a3da91b3073be50dd1544a1b17a82521b60637baaa4643421
|
4
|
+
data.tar.gz: 711cd9daff96b69e24d54a8e21803bcf85bf64e60ab813ba168d943e7092f236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
1
|
+
# Sidekiq Transaction Guard
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![
|
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.
|
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 =
|
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
|
-
.
|
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(
|
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
|
-
|
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.
|
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:
|
10
|
+
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
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.
|
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
|
data/.github/dependabot.yml
DELETED
@@ -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
|