good_job 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -4
- data/lib/good_job/scheduler.rb +20 -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: 86268c6767ba44783707ed768fe726b7a53592e46468ed49bd38d427ff4919af
|
4
|
+
data.tar.gz: 5fa72a4aaec59a31ba437eac31f9a6785cdb548c6694bea332434baf58aaad98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63baa745a861101b1a65c7a2dd7f4ec603a50714d5952a7ad942f30b41543643e6b7e1f19b1373f280668f212c6e173c4aa90d7d3a0770a92c1e159ae30215b
|
7
|
+
data.tar.gz: 7bf564c4cfc0804f1a32995214195736e9cbd8d8f7a5b45d3ffe7efecf3d43126d412594855d50c9637c646e82838112a4869a4732fa0fe5ba1542b558facd0f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.7.1](https://github.com/bensheldon/good_job/tree/v1.7.1) (2021-01-27)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.7.0...v1.7.1)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Unexpected behavior with max\_threads = 1 [\#208](https://github.com/bensheldon/good_job/issues/208)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Scheduler should always push a new task on completion of previous task, regardless of available thread calculation [\#209](https://github.com/bensheldon/good_job/pull/209) ([bensheldon](https://github.com/bensheldon))
|
14
|
+
- Fix equality typo in development.rb of test\_app [\#207](https://github.com/bensheldon/good_job/pull/207) ([reczy](https://github.com/reczy))
|
15
|
+
|
3
16
|
## [v1.7.0](https://github.com/bensheldon/good_job/tree/v1.7.0) (2021-01-25)
|
4
17
|
|
5
18
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.6.0...v1.7.0)
|
@@ -101,6 +114,7 @@
|
|
101
114
|
|
102
115
|
- Ensure advisory lock CTE is MATERIALIZED on Postgres v12+ [\#179](https://github.com/bensheldon/good_job/pull/179) ([bensheldon](https://github.com/bensheldon))
|
103
116
|
- Ensure that deleted jobs are unlocked [\#178](https://github.com/bensheldon/good_job/pull/178) ([bensheldon](https://github.com/bensheldon))
|
117
|
+
- Fix job ordering for Rails 6.1 [\#174](https://github.com/bensheldon/good_job/pull/174) ([morgoth](https://github.com/morgoth))
|
104
118
|
|
105
119
|
**Closed issues:**
|
106
120
|
|
@@ -115,10 +129,6 @@
|
|
115
129
|
|
116
130
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.3.3...v1.3.4)
|
117
131
|
|
118
|
-
**Fixed bugs:**
|
119
|
-
|
120
|
-
- Fix job ordering for Rails 6.1 [\#174](https://github.com/bensheldon/good_job/pull/174) ([morgoth](https://github.com/morgoth))
|
121
|
-
|
122
132
|
## [v1.3.3](https://github.com/bensheldon/good_job/tree/v1.3.3) (2020-12-01)
|
123
133
|
|
124
134
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.3.2...v1.3.3)
|
data/lib/good_job/scheduler.rb
CHANGED
@@ -23,7 +23,7 @@ module GoodJob # :nodoc:
|
|
23
23
|
max_threads: Configuration::DEFAULT_MAX_THREADS,
|
24
24
|
auto_terminate: true,
|
25
25
|
idletime: 60,
|
26
|
-
max_queue:
|
26
|
+
max_queue: Configuration::DEFAULT_MAX_THREADS,
|
27
27
|
fallback_policy: :discard,
|
28
28
|
}.freeze
|
29
29
|
|
@@ -71,7 +71,10 @@ module GoodJob # :nodoc:
|
|
71
71
|
|
72
72
|
@max_cache = max_cache || 0
|
73
73
|
@pool_options = DEFAULT_POOL_OPTIONS.dup
|
74
|
-
|
74
|
+
if max_threads.present?
|
75
|
+
@pool_options[:max_threads] = max_threads
|
76
|
+
@pool_options[:max_queue] = max_threads
|
77
|
+
end
|
75
78
|
@pool_options[:name] = "GoodJob::Scheduler(queues=#{@performer.name} max_threads=#{@pool_options[:max_threads]})"
|
76
79
|
|
77
80
|
create_pool
|
@@ -163,7 +166,7 @@ module GoodJob # :nodoc:
|
|
163
166
|
def task_observer(time, output, thread_error)
|
164
167
|
GoodJob.on_thread_error.call(thread_error) if thread_error && GoodJob.on_thread_error.respond_to?(:call)
|
165
168
|
instrument("finished_job_task", { result: output, error: thread_error, time: time })
|
166
|
-
|
169
|
+
create_task if output
|
167
170
|
end
|
168
171
|
|
169
172
|
def warm_cache
|
@@ -181,11 +184,11 @@ module GoodJob # :nodoc:
|
|
181
184
|
{
|
182
185
|
name: @performer.name,
|
183
186
|
max_threads: @pool_options[:max_threads],
|
184
|
-
active_threads: @
|
185
|
-
|
187
|
+
active_threads: @pool_options[:max_threads] - @pool.ready_worker_count,
|
188
|
+
available_threads: @pool.ready_worker_count,
|
186
189
|
max_cache: @max_cache,
|
187
|
-
|
188
|
-
|
190
|
+
active_cache: cache_count,
|
191
|
+
available_cache: remaining_cache_count,
|
189
192
|
}
|
190
193
|
end
|
191
194
|
|
@@ -200,6 +203,16 @@ module GoodJob # :nodoc:
|
|
200
203
|
end
|
201
204
|
end
|
202
205
|
|
206
|
+
def create_task(delay = 0)
|
207
|
+
future = Concurrent::ScheduledTask.new(delay, args: [@performer], executor: @pool, timer_set: timer_set) do |performer|
|
208
|
+
output = nil
|
209
|
+
Rails.application.executor.wrap { output = performer.next }
|
210
|
+
output
|
211
|
+
end
|
212
|
+
future.add_observer(self, :task_observer)
|
213
|
+
future.execute
|
214
|
+
end
|
215
|
+
|
203
216
|
def instrument(name, payload = {}, &block)
|
204
217
|
payload = payload.reverse_merge({
|
205
218
|
scheduler: self,
|
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.7.
|
4
|
+
version: 1.7.1
|
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-01-
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|