retry_on_deadlock 0.1.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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +94 -0
- data/Rakefile +12 -0
- data/lib/retry_on_deadlock/configuration.rb +13 -0
- data/lib/retry_on_deadlock/core.rb +69 -0
- data/lib/retry_on_deadlock/version.rb +5 -0
- data/lib/retry_on_deadlock.rb +25 -0
- data/retry_on_deadlock.gemspec +62 -0
- data/sig/retry_on_deadlock.rbs +4 -0
- metadata +144 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 38dd996dd0e58a3b8294ee3fc9bdea8ed750ffc27520ab7257af6a0ef7a75222
|
|
4
|
+
data.tar.gz: 8da1c9f9caa2df8f84231a1757758378b81fab67414ef25cc60e7f136efc1a7c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f33f305002535c421a484316d48c4066d9dc6a069685875fbbef3d8a13f0d296913e0c797562c1d05bcac6624b6aee9a90ac265a48d9f7d44ddcb5d005fa3cdd
|
|
7
|
+
data.tar.gz: 1bd6fc143aaa5a8ff94c9fc92b0b75c1f6e924f528abb46cdb4b84c46d1984617a3c2e7f633662946ee282c8ae29ad88743c175b6d91c9f9996754f4f2a518c3
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
+
advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email
|
|
26
|
+
address, without their explicit permission
|
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
+
professional setting
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
+
|
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
+
|
|
40
|
+
## Enforcement
|
|
41
|
+
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at aiman.abutalaah@jisr.net. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
+
|
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
+
|
|
46
|
+
## Enforcement Guidelines
|
|
47
|
+
|
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
+
|
|
50
|
+
### 1. Correction
|
|
51
|
+
|
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
+
|
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
+
|
|
56
|
+
### 2. Warning
|
|
57
|
+
|
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
+
|
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
+
|
|
62
|
+
### 3. Temporary Ban
|
|
63
|
+
|
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
+
|
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
+
|
|
68
|
+
### 4. Permanent Ban
|
|
69
|
+
|
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
+
|
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
+
|
|
74
|
+
## Attribution
|
|
75
|
+
|
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
+
|
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
+
|
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
|
82
|
+
|
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aiman Abu Talaah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# RetryOnDeadlock
|
|
2
|
+
|
|
3
|
+
RetryOnDeadlock is a Ruby gem designed to handle deadlocks in ActiveRecord transactions by automatically retrying them with exponential backoff. This gem is particularly useful in high-concurrency environments where deadlocks are common.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'retry_on_deadlock'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ gem install retry_on_deadlock
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
To use RetryOnDeadlock, simply include it in your ActiveRecord transactions. By default, the gem retries transactions up to 3 times when a deadlock occurs.
|
|
28
|
+
|
|
29
|
+
Here is an example:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
Car.transaction(retry_on_deadlock: true) do
|
|
33
|
+
car = Car.find(1)
|
|
34
|
+
car.update!(name: "Updated Name")
|
|
35
|
+
end
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Configuration
|
|
39
|
+
|
|
40
|
+
You can configure the gem to suit your needs. For example:
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
RetryOnDeadlock.configure do |config|
|
|
44
|
+
config.max_retries = 5 # Number of retries before giving up
|
|
45
|
+
config.enable_logging = true # Enable logging of retry attempts
|
|
46
|
+
config.log_level = :info # Log level for retry logs
|
|
47
|
+
config.logger = Logger.new(STDOUT) # Custom logger
|
|
48
|
+
config.always_retry = false # Always retry transactions unless explicitly disabled
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Nested Transactions
|
|
53
|
+
|
|
54
|
+
RetryOnDeadlock does not retry nested transactions. If a deadlock occurs within a nested transaction, the error will be raised immediately.
|
|
55
|
+
|
|
56
|
+
## Potential Risks
|
|
57
|
+
|
|
58
|
+
1. **Increased Database Load**:
|
|
59
|
+
- Retrying transactions can increase the load on your database, especially if retries are frequent. Use with caution in high-traffic applications.
|
|
60
|
+
|
|
61
|
+
2. **Nested Transactions**:
|
|
62
|
+
- The gem does not retry nested transactions. Ensure your application can handle errors in such cases.
|
|
63
|
+
|
|
64
|
+
3. **Exceeding Max Retries**:
|
|
65
|
+
- If the maximum number of retries is exceeded, the original `ActiveRecord::Deadlocked` error will be raised. Make sure your application handles this scenario gracefully.
|
|
66
|
+
|
|
67
|
+
4. **Compatibility**:
|
|
68
|
+
- The gem is designed for ActiveRecord and assumes a PostgreSQL database. It may not work as expected with other databases or ORMs.
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
73
|
+
|
|
74
|
+
To install this gem onto your local machine, run:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
$ bundle exec rake install
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To release a new version, update the version number in `version.rb`, and then run:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
$ bundle exec rake release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
87
|
+
|
|
88
|
+
## Contributing
|
|
89
|
+
|
|
90
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/retry_on_deadlock. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/retry_on_deadlock/blob/master/CODE_OF_CONDUCT.md).
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module RetryOnDeadlock
|
|
2
|
+
class Configuration
|
|
3
|
+
attr_accessor :max_retries, :logger, :enable_logging, :log_level, :always_retry
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@max_retries = 3
|
|
7
|
+
@enable_logging = true
|
|
8
|
+
@log_level = :warning
|
|
9
|
+
@logger = Logger.new(STDOUT)
|
|
10
|
+
@always_retry = false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module RetryOnDeadlock
|
|
2
|
+
WAIT_TIMES = [0, 1, 2, 4, 8, 16, 32]
|
|
3
|
+
|
|
4
|
+
# Helper method to determine if retry should be attempted
|
|
5
|
+
def should_retry?(kwargs)
|
|
6
|
+
kwargs[:retry_on_deadlock] != false && (RetryOnDeadlock.configuration.always_retry || kwargs[:retry_on_deadlock])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Retries a transaction if a deadlock is detected.
|
|
10
|
+
# @param [Array] args Arguments passed to the transaction.
|
|
11
|
+
# @param [Hash] kwargs Keyword arguments, including `retry_on_deadlock`.
|
|
12
|
+
# @param [Proc] block The block to execute within the transaction.
|
|
13
|
+
def transaction(*args, **kwargs, &block)
|
|
14
|
+
if should_retry?(kwargs)
|
|
15
|
+
transaction_with_lock_handling(*args, **kwargs.merge(retry_count: 0), &block)
|
|
16
|
+
else
|
|
17
|
+
super(*args, **kwargs.except(:retry_on_deadlock), &block)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
# Safely retries the transaction in case of a deadlock.
|
|
24
|
+
# @param [Array] args Arguments passed to the transaction.
|
|
25
|
+
# @param [Hash] kwargs Keyword arguments, including `retry_count`.
|
|
26
|
+
# @param [Proc] block The block to execute within the transaction.
|
|
27
|
+
def transaction_with_lock_handling(*args, **kwargs, &block)
|
|
28
|
+
retry_count = kwargs[:retry_count]
|
|
29
|
+
loop do
|
|
30
|
+
begin
|
|
31
|
+
return transaction(*args, **kwargs.except(:retry_count).merge(retry_on_deadlock: false), &block)
|
|
32
|
+
rescue ActiveRecord::Deadlocked => error
|
|
33
|
+
raise error if inner_transaction?
|
|
34
|
+
raise error if retry_count >= RetryOnDeadlock.configuration.max_retries
|
|
35
|
+
|
|
36
|
+
log_details(error, retry_count) if RetryOnDeadlock.configuration.enable_logging
|
|
37
|
+
retry_count += 1
|
|
38
|
+
exponential_backoff(retry_count)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Implements exponential backoff based on the retry count.
|
|
44
|
+
# @param [Integer] count The current retry count.
|
|
45
|
+
def exponential_backoff(count)
|
|
46
|
+
sec = WAIT_TIMES[count - 1] || WAIT_TIMES.max
|
|
47
|
+
sleep(sec) if sec != 0
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Checks if the current transaction is nested.
|
|
51
|
+
# @return [Boolean] True if the transaction is nested, false otherwise.
|
|
52
|
+
def inner_transaction?
|
|
53
|
+
connection.open_transactions != 0
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Logs details about the deadlock and retry attempt.
|
|
57
|
+
# @param [Exception] exception The exception that triggered the retry.
|
|
58
|
+
# @param [Integer] retry_count The current retry count.
|
|
59
|
+
def log_details(exception, retry_count)
|
|
60
|
+
if RetryOnDeadlock.configuration.logger
|
|
61
|
+
log_level = RetryOnDeadlock.configuration.log_level
|
|
62
|
+
message = <<~TXT
|
|
63
|
+
RetryOnDeadlock: retry triggered, count #{retry_count}
|
|
64
|
+
#{exception.message}
|
|
65
|
+
TXT
|
|
66
|
+
RetryOnDeadlock.configuration.logger.send(log_level, message)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Copyright (c) 2025 Aiman Abu Talaah. Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
require "active_record"
|
|
5
|
+
require "logger"
|
|
6
|
+
require "retry_on_deadlock/version"
|
|
7
|
+
require "retry_on_deadlock/configuration"
|
|
8
|
+
require "retry_on_deadlock/core"
|
|
9
|
+
require 'byebug'
|
|
10
|
+
|
|
11
|
+
module RetryOnDeadlock
|
|
12
|
+
class Error < StandardError; end
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
attr_accessor :configuration
|
|
16
|
+
|
|
17
|
+
# Configure the gem
|
|
18
|
+
def configure
|
|
19
|
+
self.configuration ||= Configuration.new
|
|
20
|
+
yield(configuration) if block_given?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
ActiveRecord::Base.send(:extend, RetryOnDeadlock)
|
|
25
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/retry_on_deadlock/version"
|
|
4
|
+
# Gem::Specification.new do |spec|
|
|
5
|
+
# spec.name = "deadlock_retry"
|
|
6
|
+
# spec.version = "0.1.0"
|
|
7
|
+
# spec.authors = ["Your Name"]
|
|
8
|
+
# spec.email = ["your.email@example.com"]
|
|
9
|
+
|
|
10
|
+
# spec.summary = "Automatically retry ActiveRecord transactions on deadlocks."
|
|
11
|
+
# spec.description = "A gem to handle deadlocks in ActiveRecord by retrying transactions and logging details."
|
|
12
|
+
# spec.homepage = "https://github.com/yourusername/deadlock_retry"
|
|
13
|
+
# spec.license = "MIT"
|
|
14
|
+
|
|
15
|
+
# spec.files = Dir["lib/**/*", "README.md", "LICENSE.txt"]
|
|
16
|
+
# spec.require_paths = ["lib"]
|
|
17
|
+
|
|
18
|
+
# spec.add_dependency "activerecord", ">= 5.0"
|
|
19
|
+
# spec.add_dependency "activesupport", ">= 5.0"
|
|
20
|
+
|
|
21
|
+
# spec.add_development_dependency "rspec", "~> 3.0"
|
|
22
|
+
# spec.add_development_dependency "pg", "~> 1.0"
|
|
23
|
+
# spec.add_development_dependency "pry", "~> 0.13"
|
|
24
|
+
# end
|
|
25
|
+
Gem::Specification.new do |spec|
|
|
26
|
+
spec.name = "retry_on_deadlock"
|
|
27
|
+
spec.version = RetryOnDeadlock::VERSION
|
|
28
|
+
spec.authors = ["Aiman Abu Talaah"]
|
|
29
|
+
spec.email = ["aiman.abutalaah@gmail.com"]
|
|
30
|
+
|
|
31
|
+
spec.summary = "Automatically retry ActiveRecord transactions on deadlocks."
|
|
32
|
+
spec.description = "A gem to handle deadlocks in ActiveRecord by retrying transactions and logging details."
|
|
33
|
+
spec.homepage = "https://github.com/yourusername/deadlock_retry"
|
|
34
|
+
spec.license = "MIT"
|
|
35
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
36
|
+
|
|
37
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
|
38
|
+
|
|
39
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
40
|
+
spec.metadata["source_code_uri"] = "https://github.com/yourusername/deadlock_retry"
|
|
41
|
+
spec.metadata["changelog_uri"] = "https://github.com/yourusername/deadlock_retry"
|
|
42
|
+
|
|
43
|
+
# Specify which files should be added to the gem when it is released.
|
|
44
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
45
|
+
spec.files = Dir.chdir(__dir__) do
|
|
46
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
47
|
+
(File.expand_path(f) == __FILE__) ||
|
|
48
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
spec.bindir = "exe"
|
|
52
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
53
|
+
spec.require_paths = ["lib"]
|
|
54
|
+
|
|
55
|
+
spec.add_runtime_dependency "activerecord", "~> 5.0"
|
|
56
|
+
spec.add_runtime_dependency "activesupport", "~> 5.0"
|
|
57
|
+
|
|
58
|
+
spec.add_development_dependency "byebug", "~> 11.0"
|
|
59
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
60
|
+
spec.add_development_dependency "pg", "~> 1.0"
|
|
61
|
+
spec.add_development_dependency "pry", "~> 0.13"
|
|
62
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: retry_on_deadlock
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Aiman Abu Talaah
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-05-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activerecord
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '5.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '5.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: activesupport
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '5.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '5.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: byebug
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '11.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '11.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: pg
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '1.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: pry
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.13'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.13'
|
|
97
|
+
description: A gem to handle deadlocks in ActiveRecord by retrying transactions and
|
|
98
|
+
logging details.
|
|
99
|
+
email:
|
|
100
|
+
- aiman.abutalaah@gmail.com
|
|
101
|
+
executables: []
|
|
102
|
+
extensions: []
|
|
103
|
+
extra_rdoc_files: []
|
|
104
|
+
files:
|
|
105
|
+
- ".rspec"
|
|
106
|
+
- ".rubocop.yml"
|
|
107
|
+
- CHANGELOG.md
|
|
108
|
+
- CODE_OF_CONDUCT.md
|
|
109
|
+
- LICENSE.txt
|
|
110
|
+
- README.md
|
|
111
|
+
- Rakefile
|
|
112
|
+
- lib/retry_on_deadlock.rb
|
|
113
|
+
- lib/retry_on_deadlock/configuration.rb
|
|
114
|
+
- lib/retry_on_deadlock/core.rb
|
|
115
|
+
- lib/retry_on_deadlock/version.rb
|
|
116
|
+
- retry_on_deadlock.gemspec
|
|
117
|
+
- sig/retry_on_deadlock.rbs
|
|
118
|
+
homepage: https://github.com/yourusername/deadlock_retry
|
|
119
|
+
licenses:
|
|
120
|
+
- MIT
|
|
121
|
+
metadata:
|
|
122
|
+
homepage_uri: https://github.com/yourusername/deadlock_retry
|
|
123
|
+
source_code_uri: https://github.com/yourusername/deadlock_retry
|
|
124
|
+
changelog_uri: https://github.com/yourusername/deadlock_retry
|
|
125
|
+
post_install_message:
|
|
126
|
+
rdoc_options: []
|
|
127
|
+
require_paths:
|
|
128
|
+
- lib
|
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: 3.0.0
|
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
requirements: []
|
|
140
|
+
rubygems_version: 3.4.21
|
|
141
|
+
signing_key:
|
|
142
|
+
specification_version: 4
|
|
143
|
+
summary: Automatically retry ActiveRecord transactions on deadlocks.
|
|
144
|
+
test_files: []
|