rocketjob 5.4.0 → 5.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bf1e6e7eb0a44011830a99c689c56768857d8de4c4e2c95e6b536feb6f63aab
4
- data.tar.gz: '0172629dc33a08bfbd976599b619a41495680124dcd7df9a08e61308f0d043b4'
3
+ metadata.gz: 97910a2bbdcc67b808677e01f9ef9650935deac9f47ee415ad7665227e06e2a3
4
+ data.tar.gz: 9c560b2a1deea93eb4c8e9cdf6fb28f2308e8f9a85457660c292ad38a2b76137
5
5
  SHA512:
6
- metadata.gz: 6ac52c54834a7370dfdb9e7460ca1818c19b91beb2afc875ba0edab63a9b0d9480bc704a35bd155825f3c0b280efea9a406783212e8621fcbf6b046b8af62e78
7
- data.tar.gz: f044d85630a0b6b36b07f7092ec18ac452d608cb9c7dbb7d26235493c51df584d7479190b24dfd1805ba7a086c8188e48ab8b02590d0748d013c6fb462b01505
6
+ metadata.gz: 768538825ba34f58d915205fb1c61066ef2d86d9c3743f487db381074e30bd75c420f99f017adbb338c0dd4f202a69cf699b0b4e2a9ebc0581423fb102c85284
7
+ data.tar.gz: 17d494818bf341a6b3340f4c0c5d5b77ec68c05eeb26d10eccb43c81221c14acd64ffe73ea1f610b514f233c84d5cc7cf3c2a10f4d1410b9b427308d22f5ad53
@@ -47,24 +47,19 @@ module RocketJob
47
47
 
48
48
  # Returns [Boolean] whether the throttle for this job has been exceeded
49
49
  def throttle_running_workers_exceeded?(slice)
50
- return unless throttle_running_workers&.positive?
50
+ return false unless throttle_running_workers&.positive?
51
51
 
52
52
  input.running.with(read: {mode: :primary}) do |conn|
53
53
  conn.where(:id.ne => slice.id).count >= throttle_running_workers
54
54
  end
55
55
  end
56
56
 
57
- # Returns [Boolean] whether the throttle for this job has been exceeded
58
- #
59
- # With a Batch job, allow a higher priority queued job to replace a running one with
60
- # a lower priority.
61
- def throttle_running_jobs_exceeded?
62
- return unless throttle_running_jobs&.positive?
63
-
64
- # Cannot use this class since it will include instances of parent job classes.
65
- RocketJob::Job.with(read: {mode: :primary}) do |conn|
66
- conn.running.where("_type" => self.class.name, :id.ne => id, :priority.lte => priority).count >= throttle_running_jobs
67
- end
57
+ # Allows another job with a higher priority to start even though this one is running already
58
+ # @overrides RocketJob::Plugins::Job::ThrottleRunningJobs#throttle_running_jobs_base_query
59
+ def throttle_running_jobs_base_query
60
+ query = super
61
+ query[:priority.lte] = priority if throttle_running_workers&.positive?
62
+ query
68
63
  end
69
64
  end
70
65
  end
@@ -39,14 +39,18 @@ module RocketJob
39
39
 
40
40
  # Returns [Boolean] whether the throttle for this job has been exceeded
41
41
  def throttle_running_jobs_exceeded?
42
- return unless throttle_running_jobs&.positive?
42
+ return false unless throttle_running_jobs&.positive?
43
43
 
44
44
  RocketJob::Job.with(read: {mode: :primary}) do |conn|
45
- query = {:id.ne => id}
45
+ query = throttle_running_jobs_base_query
46
46
  throttle_group ? query["throttle_group"] = throttle_group : query["_type"] = self.class.name
47
47
  conn.running.where(query).count >= throttle_running_jobs
48
48
  end
49
49
  end
50
+
51
+ def throttle_running_jobs_base_query
52
+ {:id.ne => id}
53
+ end
50
54
  end
51
55
  end
52
56
  end
@@ -1,3 +1,3 @@
1
1
  module RocketJob
2
- VERSION = "5.4.0".freeze
2
+ VERSION = "5.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-08 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm