good_job 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/generators/good_job/install_generator.rb +6 -0
- data/lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb +1 -1
- data/lib/generators/good_job/templates/update/migrations/{01_create_good_jobs.rb → 01_create_good_jobs.rb.erb} +1 -1
- data/lib/generators/good_job/update_generator.rb +6 -0
- data/lib/good_job/active_job_extensions/concurrency.rb +3 -4
- data/lib/good_job/execution.rb +1 -7
- data/lib/good_job/lockable.rb +1 -1
- data/lib/good_job/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06b525450f56cf74ff31e06e11cbf3bf2ee7f20d753973e70ddb53d67eb48d1
|
4
|
+
data.tar.gz: d25d2037ae03eaea0ff8bd4ca1dfa52ba6a57d3420e53b4be265dc7c0be580cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f2be221d400f0dc7a1e7c2d262b717ecd9c88a5192771df2bd343d61e878cb777af7e067814e3e7c751aa28716c2bd487b4389ef4dbbea17cc2a6a0f23d0c9a
|
7
|
+
data.tar.gz: abfd020a2203bb573c5e801e7f278214ebe996b6e63970ec60313fcb37a3b21cb901d4cf57cfd6739b7c247ea692ff7de012df3668d7c551d7ced78cc48b79e6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v2.4.2](https://github.com/bensheldon/good_job/tree/v2.4.2) (2021-10-19)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.4.1...v2.4.2)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add migration version to install/update generator templates [\#426](https://github.com/bensheldon/good_job/pull/426) ([bensheldon](https://github.com/bensheldon))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Explicitly unscope queries within block yielded to Lockable.within\_advisory\_lock [\#429](https://github.com/bensheldon/good_job/pull/429) ([bensheldon](https://github.com/bensheldon))
|
14
|
+
- Fix Demo CleanupJob args [\#427](https://github.com/bensheldon/good_job/pull/427) ([bensheldon](https://github.com/bensheldon))
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Remove v1.99/v2 transitional extra advisory lock [\#428](https://github.com/bensheldon/good_job/pull/428) ([bensheldon](https://github.com/bensheldon))
|
19
|
+
|
3
20
|
## [v2.4.1](https://github.com/bensheldon/good_job/tree/v2.4.1) (2021-10-11)
|
4
21
|
|
5
22
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.4.0...v2.4.1)
|
@@ -19,5 +19,11 @@ module GoodJob
|
|
19
19
|
def create_migration_file
|
20
20
|
migration_template 'migrations/create_good_jobs.rb.erb', File.join(db_migrate_path, "create_good_jobs.rb")
|
21
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def migration_version
|
26
|
+
"[#{ActiveRecord::VERSION::STRING.to_f}]"
|
27
|
+
end
|
22
28
|
end
|
23
29
|
end
|
@@ -32,10 +32,9 @@ module GoodJob
|
|
32
32
|
|
33
33
|
GoodJob::Execution.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
|
34
34
|
enqueue_concurrency = if enqueue_limit
|
35
|
-
|
36
|
-
GoodJob::Execution.unscoped.where(concurrency_key: key).unfinished.advisory_unlocked.count
|
35
|
+
GoodJob::Execution.where(concurrency_key: key).unfinished.advisory_unlocked.count
|
37
36
|
else
|
38
|
-
GoodJob::Execution.
|
37
|
+
GoodJob::Execution.where(concurrency_key: key).unfinished.count
|
39
38
|
end
|
40
39
|
|
41
40
|
# The job has not yet been enqueued, so check if adding it will go over the limit
|
@@ -63,7 +62,7 @@ module GoodJob
|
|
63
62
|
next if key.blank?
|
64
63
|
|
65
64
|
GoodJob::Execution.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
|
66
|
-
allowed_active_job_ids = GoodJob::Execution.
|
65
|
+
allowed_active_job_ids = GoodJob::Execution.where(concurrency_key: key).advisory_locked.order(Arel.sql("COALESCE(performed_at, scheduled_at, created_at) ASC")).limit(perform_limit).pluck(:active_job_id)
|
67
66
|
# The current job has already been locked and will appear in the previous query
|
68
67
|
raise GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError unless allowed_active_job_ids.include? job.job_id
|
69
68
|
end
|
data/lib/good_job/execution.rb
CHANGED
@@ -174,13 +174,7 @@ module GoodJob
|
|
174
174
|
break if execution.blank?
|
175
175
|
break :unlocked unless execution&.executable?
|
176
176
|
|
177
|
-
|
178
|
-
execution.with_advisory_lock(key: "good_jobs-#{execution.active_job_id}") do
|
179
|
-
execution.perform
|
180
|
-
end
|
181
|
-
rescue RecordAlreadyAdvisoryLockedError => e
|
182
|
-
ExecutionResult.new(value: nil, handled_error: e)
|
183
|
-
end
|
177
|
+
execution.perform
|
184
178
|
end
|
185
179
|
end
|
186
180
|
|
data/lib/good_job/lockable.rb
CHANGED
data/lib/good_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: good_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -379,7 +379,7 @@ files:
|
|
379
379
|
- lib/active_job/queue_adapters/good_job_adapter.rb
|
380
380
|
- lib/generators/good_job/install_generator.rb
|
381
381
|
- lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb
|
382
|
-
- lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb
|
382
|
+
- lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb.erb
|
383
383
|
- lib/generators/good_job/update_generator.rb
|
384
384
|
- lib/good_job.rb
|
385
385
|
- lib/good_job/active_job_extensions.rb
|