good_job 1.12.1 → 1.12.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 +13 -1
- data/lib/good_job/active_job_extensions/concurrency.rb +7 -7
- data/lib/good_job/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0af2c2293c2a0970a95ac200776850daa396a91d75aeda3f4612de23ee951a5c
|
4
|
+
data.tar.gz: c938c0efca849771e68b39634e56fbdacf2987a83bdf8115e8050b9c49da40c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b4da4eec468271fc88260fc0abcdb6faaaa9e43532e5587338fdca0a4f92f89d4e4f780678fe2c74a714adb0e7a1af263fb0578193382ee8181e11c44aea20d
|
7
|
+
data.tar.gz: 91f4ae034471774f5ec1915750ccbf1d9d6ad9cc68df4f5ffa4c0bf6bca57928115e6871a59d30d6bab79b22faa7a4a293d55f55c1bf2cc659d55c0c60049040
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.12.2](https://github.com/bensheldon/good_job/tree/v1.12.2) (2021-08-13)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.12.1...v1.12.2)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Fixes for race conditions in ActiveJob concurrency extension [\#326](https://github.com/bensheldon/good_job/pull/326) ([codyrobbins](https://github.com/codyrobbins))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- On gem release, add instructions to author a Github Release [\#324](https://github.com/bensheldon/good_job/pull/324) ([bensheldon](https://github.com/bensheldon))
|
14
|
+
|
3
15
|
## [v1.12.1](https://github.com/bensheldon/good_job/tree/v1.12.1) (2021-08-05)
|
4
16
|
|
5
17
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.12.0...v1.12.1)
|
@@ -29,7 +41,7 @@
|
|
29
41
|
- Add the ability to schedule repeating / recurring / cron-like jobs [\#53](https://github.com/bensheldon/good_job/issues/53)
|
30
42
|
- Add cron-like support for recurring/repeating jobs [\#297](https://github.com/bensheldon/good_job/pull/297) ([bensheldon](https://github.com/bensheldon))
|
31
43
|
|
32
|
-
**
|
44
|
+
**Fixed bugs:**
|
33
45
|
|
34
46
|
- Place Dashboard shared view partials under `good_job` namespace [\#310](https://github.com/bensheldon/good_job/pull/310) ([bensheldon](https://github.com/bensheldon))
|
35
47
|
- Ensure Dashboard inline javascript has CSP nonce for strict Content-Security Policy [\#309](https://github.com/bensheldon/good_job/pull/309) ([bensheldon](https://github.com/bensheldon))
|
@@ -9,21 +9,21 @@ module GoodJob
|
|
9
9
|
included do
|
10
10
|
class_attribute :good_job_concurrency_config, instance_accessor: false, default: {}
|
11
11
|
|
12
|
-
|
12
|
+
around_enqueue do |job, block|
|
13
13
|
# Always allow jobs to be retried because the current job's execution will complete momentarily
|
14
|
-
next if CurrentExecution.active_job_id == job.job_id
|
14
|
+
next(block.call) if CurrentExecution.active_job_id == job.job_id
|
15
15
|
|
16
16
|
limit = job.class.good_job_concurrency_config.fetch(:enqueue_limit, Float::INFINITY)
|
17
|
-
next if limit.blank? || (0...Float::INFINITY).exclude?(limit)
|
17
|
+
next(block.call) if limit.blank? || (0...Float::INFINITY).exclude?(limit)
|
18
18
|
|
19
19
|
key = job.good_job_concurrency_key
|
20
|
-
next if key.blank?
|
20
|
+
next(block.call) if key.blank?
|
21
21
|
|
22
22
|
GoodJob::Job.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
|
23
23
|
# TODO: Why is `unscoped` necessary? Nested scope is bleeding into subsequent query?
|
24
24
|
enqueue_concurrency = GoodJob::Job.unscoped.where(concurrency_key: key).unfinished.count
|
25
25
|
# The job has not yet been enqueued, so check if adding it will go over the limit
|
26
|
-
|
26
|
+
block.call unless enqueue_concurrency + 1 > limit
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -41,9 +41,9 @@ module GoodJob
|
|
41
41
|
next if key.blank?
|
42
42
|
|
43
43
|
GoodJob::Job.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
|
44
|
-
|
44
|
+
allowed_active_job_ids = GoodJob::Job.unscoped.where(concurrency_key: key).advisory_locked.order(Arel.sql("COALESCE(performed_at, scheduled_at, created_at) ASC")).limit(limit).pluck(:active_job_id)
|
45
45
|
# The current job has already been locked and will appear in the previous query
|
46
|
-
raise GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError
|
46
|
+
raise GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError unless allowed_active_job_ids.include? job.job_id
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
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: 1.12.
|
4
|
+
version: 1.12.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-08-
|
11
|
+
date: 2021-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|