delayed_job_active_record 4.1.8 → 4.1.9.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/delayed_job_active_record.gemspec +16 -11
- data/lib/delayed/backend/active_record.rb +22 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9bd9b9925ce784195d7b0a12b88a751b03c6cb80a35f0cce0de1826b705731
|
4
|
+
data.tar.gz: 70566e7ed9bb444d25a012b922c72059b569003ea419fa4a6f4d4897e4dab34c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3daf9414b2f1719867e5847d284eceef91d86265da8b08ae4f74dfa0681edd4c7865c0166a590ac2827a9fd98beffb174bd02903e53bd9fdb74462ae471b047e
|
7
|
+
data.tar.gz: '097203e0d6552cc4e2c204e318d0fad01daf560fcf193141abad7d23563316791fa6afec8c855c1de6a3b7b7158f7a2426eb4a1637f48a7c8e93f11ef7f9c363'
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
**If you're viewing this at https://github.com/collectiveidea/delayed_job_active_record,
|
2
2
|
you're reading the documentation for the master branch.
|
3
3
|
[View documentation for the latest release
|
4
|
-
(4.1.
|
4
|
+
(4.1.9.rc1).](https://github.com/collectiveidea/delayed_job_active_record/tree/v4.1.9.rc1)**
|
5
5
|
|
6
6
|
# DelayedJob ActiveRecord Backend
|
7
7
|
|
@@ -1,17 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "delayed_job_active_record"
|
5
|
+
spec.version = "4.1.9.rc1"
|
6
|
+
spec.summary = "ActiveRecord backend for DelayedJob"
|
7
|
+
spec.description = "ActiveRecord backend for Delayed::Job, originally authored by Tobias Lütke"
|
8
|
+
|
9
|
+
spec.licenses = "MIT"
|
10
|
+
|
11
|
+
spec.authors = ["David Genord II", "Brian Ryckbost", "Matt Griffin", "Erik Michaels-Ober"]
|
12
|
+
spec.email = ["david@collectiveidea.com", "bryckbost@gmail.com", "matt@griffinonline.org", "sferik@gmail.com"]
|
13
|
+
spec.homepage = "http://github.com/collectiveidea/delayed_job_active_record"
|
14
|
+
|
15
|
+
spec.files = %w[CONTRIBUTING.md LICENSE.md README.md delayed_job_active_record.gemspec] + Dir["lib/**/*.rb"]
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
19
|
+
|
4
20
|
spec.add_dependency "activerecord", [">= 3.0", "< 8.0"]
|
5
21
|
spec.add_dependency "delayed_job", [">= 3.0", "< 5"]
|
6
|
-
spec.authors = ["David Genord II", "Brian Ryckbost", "Matt Griffin", "Erik Michaels-Ober"]
|
7
|
-
spec.description = "ActiveRecord backend for Delayed::Job, originally authored by Tobias Lütke"
|
8
|
-
spec.email = ["david@collectiveidea.com", "bryckbost@gmail.com", "matt@griffinonline.org", "sferik@gmail.com"]
|
9
|
-
spec.files = %w[CONTRIBUTING.md LICENSE.md README.md delayed_job_active_record.gemspec] + Dir["lib/**/*.rb"]
|
10
|
-
spec.homepage = "http://github.com/collectiveidea/delayed_job_active_record"
|
11
|
-
spec.licenses = ["MIT"]
|
12
|
-
spec.metadata = { "rubygems_mfa_required" => "true" }
|
13
|
-
spec.name = "delayed_job_active_record"
|
14
|
-
spec.require_paths = ["lib"]
|
15
|
-
spec.summary = "ActiveRecord backend for DelayedJob"
|
16
|
-
spec.version = "4.1.8"
|
17
22
|
end
|
@@ -62,7 +62,11 @@ module Delayed
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.before_fork
|
65
|
-
::ActiveRecord::
|
65
|
+
if Gem::Version.new("7.1.0") <= Gem::Version.new(::ActiveRecord::VERSION::STRING)
|
66
|
+
::ActiveRecord::Base.clear_all_connections!(:all)
|
67
|
+
else
|
68
|
+
::ActiveRecord::Base.clear_all_connections!
|
69
|
+
end
|
66
70
|
end
|
67
71
|
|
68
72
|
def self.after_fork
|
@@ -101,7 +105,7 @@ module Delayed
|
|
101
105
|
case connection.adapter_name
|
102
106
|
when "PostgreSQL", "PostGIS"
|
103
107
|
reserve_with_scope_using_optimized_postgres(ready_scope, worker, now)
|
104
|
-
when "MySQL", "Mysql2"
|
108
|
+
when "MySQL", "Mysql2", "Trilogy"
|
105
109
|
reserve_with_scope_using_optimized_mysql(ready_scope, worker, now)
|
106
110
|
when "MSSQL", "Teradata"
|
107
111
|
reserve_with_scope_using_optimized_mssql(ready_scope, worker, now)
|
@@ -129,11 +133,23 @@ module Delayed
|
|
129
133
|
# Note: active_record would attempt to generate UPDATE...LIMIT like
|
130
134
|
# SQL for Postgres if we use a .limit() filter, but it would not
|
131
135
|
# use 'FOR UPDATE' and we would have many locking conflicts
|
136
|
+
subquery = ready_scope.limit(1).lock(true).select("id").to_sql
|
137
|
+
|
138
|
+
# On PostgreSQL >= 9.5 we leverage SKIP LOCK to avoid multiple workers blocking each other
|
139
|
+
# when attempting to get the next available job
|
140
|
+
# https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FOR-UPDATE-SHARE
|
141
|
+
if connection.send(:postgresql_version) >= 9_05_00 # rubocop:disable Style/NumericLiterals
|
142
|
+
subquery += " SKIP LOCKED"
|
143
|
+
end
|
144
|
+
|
132
145
|
quoted_name = connection.quote_table_name(table_name)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
146
|
+
find_by_sql(
|
147
|
+
[
|
148
|
+
"UPDATE #{quoted_name} SET locked_at = ?, locked_by = ? WHERE id IN (#{subquery}) RETURNING *",
|
149
|
+
now,
|
150
|
+
worker.name
|
151
|
+
]
|
152
|
+
).first
|
137
153
|
end
|
138
154
|
|
139
155
|
def self.reserve_with_scope_using_optimized_mysql(ready_scope, worker, now)
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.9.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Genord II
|
8
8
|
- Brian Ryckbost
|
9
9
|
- Matt Griffin
|
10
10
|
- Erik Michaels-Ober
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activerecord
|
@@ -80,7 +80,7 @@ licenses:
|
|
80
80
|
- MIT
|
81
81
|
metadata:
|
82
82
|
rubygems_mfa_required: 'true'
|
83
|
-
post_install_message:
|
83
|
+
post_install_message:
|
84
84
|
rdoc_options: []
|
85
85
|
require_paths:
|
86
86
|
- lib
|
@@ -95,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
99
|
-
signing_key:
|
98
|
+
rubygems_version: 3.5.11
|
99
|
+
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: ActiveRecord backend for DelayedJob
|
102
102
|
test_files: []
|