delayed_job_active_record 4.1.8 → 4.1.9

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: 6f3787467e904817090ad112e500a855194661f9295623517cc73c0bbb930c57
4
- data.tar.gz: 200346cb19ab7030a82e86c41499220a6aab7e76bec940b14a17b39a96f13490
3
+ metadata.gz: f6046ece47a2c4aa29a266779efaedac997992b9172730d773170adc6db546aa
4
+ data.tar.gz: 4be7b12bce35574cf048a5fd68cfc7b4ba18d4a2c4d15985b4f6f3c91d080bd9
5
5
  SHA512:
6
- metadata.gz: 96b163e6ddbd7dd28c1b8bfd33fcbc7c39ee3b7c66af76774e45f7cf60f88946b26c8afa994af786ce7b4960f33c41209bcc75a99c4c0fd8b023ad83bd737c52
7
- data.tar.gz: f149d6efdc7b06935639ea8f57d39f32710f1961f285b9a1baf0afd95c8bd30553d2a2c7e59e9ced337d323008a173832c6724af12d4788976808bb9bfae6f60
6
+ metadata.gz: f0c5be68c20be69bcfcf118ca1ceec6a1b19b31de210b34c6323b5829f991e81fce06de3da6d366f94c3de904a4e984c1b19ad04d4d899eb7372dd091c4fc3f3
7
+ data.tar.gz: 46dc494917d07108c594dd6fc339d416ffeae82daa75d1298df3b79859e6a03874d56b215afec7e6e11ffd0f371cbef26f85265c28bfe38e2fb9545151e01b75
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.7).](https://github.com/collectiveidea/delayed_job_active_record/tree/v4.1.8)**
4
+ (4.1.9).](https://github.com/collectiveidea/delayed_job_active_record/tree/v4.1.9)**
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"
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::Base.connection_handler.clear_all_connections!
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
- subquery = ready_scope.limit(1).lock(true).select("id").to_sql
134
- sql = "UPDATE #{quoted_name} SET locked_at = ?, locked_by = ? WHERE id IN (#{subquery}) RETURNING *"
135
- reserved = find_by_sql([sql, now, worker.name])
136
- reserved[0]
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.8
4
+ version: 4.1.9
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: 2023-10-13 00:00:00.000000000 Z
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.4.20
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: []