good_job 1.3.4 → 1.3.5

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: 7c7d64f21fbabba859d20d0a277d0a963672fcfde1284881b0130b1e05e62252
4
- data.tar.gz: b7dbc95191a2bf115176f0e8ce09b8f7c997a2cb852fb673e5fee17c241434be
3
+ metadata.gz: 46b04fbfe44919834c406101ee18f2b53f5cc05e076525f7243e346fa966ca94
4
+ data.tar.gz: 798738a1f2b0c7f21457921c2c640cdc78151a09262dfa7d8a383e8778282b9d
5
5
  SHA512:
6
- metadata.gz: a0e58bf60a8008617703b575d55cdefd94fa9405d8d7cb034a75013b3a3fc8e4205833cf818d03caa137470b9ff431258d19e166e5d56f83a70667c3c484d904
7
- data.tar.gz: adc2a494ea2f4e3e4ac7f569b013edade8a223f1e54474835cba34c6ac6233760f94bbbffb62f0ed37a119f8f15dfd1310a87b304483bbae72ecd0129f10f439
6
+ metadata.gz: 841c85e7b4d9fa28d1fcdbb7c6a48771438f24ae33a264a80afdff1c9730a3438b98aa5d82f54bd1d4c979b2dab64997fbf6d64036bc96fdac6c851f70e0f68f
7
+ data.tar.gz: 9c2d11c56e3db986aa5bbecc85a317396a19ba1c838b97d32cd16f21b9cd29b6c154be817879d8c8a8925da645d298442c0ebc39aba3d5bba707ed01558b55c5
@@ -1,12 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.3.5](https://github.com/bensheldon/good_job/tree/v1.3.5) (2020-12-17)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.3.4...v1.3.5)
6
+
7
+ **Closed issues:**
8
+
9
+ - not running jobs [\#168](https://github.com/bensheldon/good_job/issues/168)
10
+ - how to run good\_job on a separate machine [\#162](https://github.com/bensheldon/good_job/issues/162)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Ensure advisory lock CTE is MATERIALIZED on Postgres v12+ [\#179](https://github.com/bensheldon/good_job/pull/179) ([bensheldon](https://github.com/bensheldon))
15
+ - Ensure that deleted jobs are unlocked [\#178](https://github.com/bensheldon/good_job/pull/178) ([bensheldon](https://github.com/bensheldon))
16
+ - Add Appraisal for Rails 6.1-rc2 [\#175](https://github.com/bensheldon/good_job/pull/175) ([bensheldon](https://github.com/bensheldon))
17
+
3
18
  ## [v1.3.4](https://github.com/bensheldon/good_job/tree/v1.3.4) (2020-12-02)
4
19
 
5
20
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.3.3...v1.3.4)
6
21
 
7
22
  **Merged pull requests:**
8
23
 
9
- - Fix job ordering. [\#174](https://github.com/bensheldon/good_job/pull/174) ([morgoth](https://github.com/morgoth))
24
+ - Fix job ordering for Rails 6.1 [\#174](https://github.com/bensheldon/good_job/pull/174) ([morgoth](https://github.com/morgoth))
10
25
 
11
26
  ## [v1.3.3](https://github.com/bensheldon/good_job/tree/v1.3.3) (2020-12-01)
12
27
 
@@ -121,6 +136,7 @@
121
136
  - Correct example on how to configure multiple queues by command line. [\#135](https://github.com/bensheldon/good_job/pull/135) ([morgoth](https://github.com/morgoth))
122
137
  - Update ActionMailer Job class, to match the default [\#130](https://github.com/bensheldon/good_job/pull/130) ([morgoth](https://github.com/morgoth))
123
138
  - Add initial Engine scaffold [\#125](https://github.com/bensheldon/good_job/pull/125) ([bensheldon](https://github.com/bensheldon))
139
+ - Zeitwerk Loader Implementation [\#123](https://github.com/bensheldon/good_job/pull/123) ([gadimbaylisahil](https://github.com/gadimbaylisahil))
124
140
  - Update code-level documentation [\#111](https://github.com/bensheldon/good_job/pull/111) ([bensheldon](https://github.com/bensheldon))
125
141
 
126
142
  ## [v1.2.4](https://github.com/bensheldon/good_job/tree/v1.2.4) (2020-09-01)
@@ -144,7 +160,6 @@
144
160
 
145
161
  **Merged pull requests:**
146
162
 
147
- - Zeitwerk Loader Implementation [\#123](https://github.com/bensheldon/good_job/pull/123) ([gadimbaylisahil](https://github.com/gadimbaylisahil))
148
163
  - Remove unused PgLocks class [\#120](https://github.com/bensheldon/good_job/pull/120) ([gadimbaylisahil](https://github.com/gadimbaylisahil))
149
164
  - Fix readme CommandLine option links [\#115](https://github.com/bensheldon/good_job/pull/115) ([gadimbaylisahil](https://github.com/gadimbaylisahil))
150
165
  - Have YARD render markdown files with GFM \(Github Flavored Markdown\) [\#113](https://github.com/bensheldon/good_job/pull/113) ([bensheldon](https://github.com/bensheldon))
@@ -334,6 +349,10 @@
334
349
 
335
350
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v0.8.2...v0.9.0)
336
351
 
352
+ **Merged pull requests:**
353
+
354
+ - Allow preservation of finished job records [\#46](https://github.com/bensheldon/good_job/pull/46) ([bensheldon](https://github.com/bensheldon))
355
+
337
356
  ## [v0.8.2](https://github.com/bensheldon/good_job/tree/v0.8.2) (2020-07-18)
338
357
 
339
358
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v0.8.1...v0.8.2)
@@ -361,7 +380,6 @@
361
380
 
362
381
  **Merged pull requests:**
363
382
 
364
- - Allow preservation of finished job records [\#46](https://github.com/bensheldon/good_job/pull/46) ([bensheldon](https://github.com/bensheldon))
365
383
  - Replace Adapter inline boolean kwarg with execution\_mode instead [\#41](https://github.com/bensheldon/good_job/pull/41) ([bensheldon](https://github.com/bensheldon))
366
384
 
367
385
  ## [v0.7.0](https://github.com/bensheldon/good_job/tree/v0.7.0) (2020-07-16)
@@ -410,7 +428,6 @@
410
428
  **Merged pull requests:**
411
429
 
412
430
  - Improve ActiveRecord usage for advisory locking [\#24](https://github.com/bensheldon/good_job/pull/24) ([bensheldon](https://github.com/bensheldon))
413
- - Remove support for Rails 5.1 [\#23](https://github.com/bensheldon/good_job/pull/23) ([bensheldon](https://github.com/bensheldon))
414
431
 
415
432
  ## [v0.3.0](https://github.com/bensheldon/good_job/tree/v0.3.0) (2020-03-22)
416
433
 
@@ -429,6 +446,7 @@
429
446
 
430
447
  **Merged pull requests:**
431
448
 
449
+ - Remove support for Rails 5.1 [\#23](https://github.com/bensheldon/good_job/pull/23) ([bensheldon](https://github.com/bensheldon))
432
450
  - Gracefully shutdown Scheduler when executable receives TERM or INT [\#17](https://github.com/bensheldon/good_job/pull/17) ([bensheldon](https://github.com/bensheldon))
433
451
  - Update Appraisals [\#16](https://github.com/bensheldon/good_job/pull/16) ([bensheldon](https://github.com/bensheldon))
434
452
 
@@ -1,19 +1,19 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Good job</title>
4
+ <title>Good Job Dashboard</title>
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
8
  <style>
9
- <%= render "vendor/bootstrap/bootstrap.css" %>
10
- <%= render "vendor/chartist/chartist.css" %>
11
- <%= render "assets/style.css" %>
9
+ <%= render file: GoodJob::Engine.root.join("app", "assets", "vendor", "bootstrap", "bootstrap.css") %>
10
+ <%= render file: GoodJob::Engine.root.join("app", "assets", "vendor", "chartist", "chartist.css") %>
11
+ <%= render file: GoodJob::Engine.root.join("app", "assets", "style.css") %>
12
12
  </style>
13
13
 
14
14
  <script>
15
- <%= render "vendor/bootstrap/bootstrap-native.js" %>
16
- <%= render "vendor/chartist/chartist.js" %>
15
+ <%= render file: GoodJob::Engine.root.join("app", "assets", "vendor", "bootstrap", "bootstrap-native.js") %>
16
+ <%= render file: GoodJob::Engine.root.join("app", "assets", "vendor", "chartist", "chartist.js") %>
17
17
  </script>
18
18
  </head>
19
19
  <body>
@@ -32,11 +32,18 @@ module GoodJob
32
32
  original_query = self
33
33
 
34
34
  cte_table = Arel::Table.new(:rows)
35
- composed_cte = Arel::Nodes::As.new(cte_table, original_query.select(primary_key).except(:limit).arel)
35
+ cte_query = original_query.select(primary_key).except(:limit)
36
+ cte_type = if supports_cte_materialization_specifiers?
37
+ 'MATERIALIZED'
38
+ else
39
+ ''
40
+ end
41
+
42
+ composed_cte = Arel::Nodes::As.new(cte_table, Arel::Nodes::SqlLiteral.new([cte_type, "(", cte_query.to_sql, ")"].join(' ')))
36
43
 
37
44
  query = cte_table.project(cte_table[:id])
38
- .with(composed_cte)
39
- .where(Arel.sql(sanitize_sql_for_conditions(["pg_try_advisory_lock(('x' || substr(md5(:table_name || #{connection.quote_table_name(cte_table.name)}.#{quoted_primary_key}::text), 1, 16))::bit(64)::bigint)", { table_name: table_name }])))
45
+ .with(composed_cte)
46
+ .where(Arel.sql(sanitize_sql_for_conditions(["pg_try_advisory_lock(('x' || substr(md5(:table_name || #{connection.quote_table_name(cte_table.name)}.#{quoted_primary_key}::text), 1, 16))::bit(64)::bigint)", { table_name: table_name }])))
40
47
 
41
48
  limit = original_query.arel.ast.limit
42
49
  query.limit = limit.value if limit.present?
@@ -132,6 +139,12 @@ module GoodJob
132
139
  records.each(&:advisory_unlock)
133
140
  end
134
141
  end
142
+
143
+ def supports_cte_materialization_specifiers?
144
+ return @supports_cte_materialization_specifiers if defined?(@supports_cte_materialization_specifiers)
145
+
146
+ @supports_cte_materialization_specifiers = ActiveRecord::Base.connection.postgresql_version >= 120000
147
+ end
135
148
  end
136
149
 
137
150
  # Acquires an advisory lock on this record if it is not already locked by
@@ -151,10 +164,11 @@ module GoodJob
151
164
  # {#advisory_unlock} and {#advisory_lock} the same number of times.
152
165
  # @return [Boolean] whether the lock was released.
153
166
  def advisory_unlock
154
- where_sql = <<~SQL.squish
155
- pg_advisory_unlock(('x' || substr(md5(:table_name || :id::text), 1, 16))::bit(64)::bigint)
167
+ query = <<~SQL.squish
168
+ SELECT 1 AS one
169
+ WHERE pg_advisory_unlock(('x'||substr(md5(:table_name || :id::text), 1, 16))::bit(64)::bigint)
156
170
  SQL
157
- self.class.unscoped.exists?([where_sql, { table_name: self.class.table_name, id: send(self.class.primary_key) }])
171
+ self.class.connection.execute(sanitize_sql_for_conditions([query, { table_name: self.class.table_name, id: send(self.class.primary_key) }])).ntuples.positive?
158
172
  end
159
173
 
160
174
  # Acquires an advisory lock on this record or raises
@@ -1,4 +1,4 @@
1
1
  module GoodJob
2
2
  # GoodJob gem version.
3
- VERSION = '1.3.4'.freeze
3
+ VERSION = '1.3.5'.freeze
4
4
  end
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.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2020-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -164,20 +164,6 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: erb_lint
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
167
  - !ruby/object:Gem::Dependency
182
168
  name: foreman
183
169
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +234,6 @@ dependencies:
248
234
  - - ">="
249
235
  - !ruby/object:Gem::Version
250
236
  version: '0'
251
- - !ruby/object:Gem::Dependency
252
- name: mdl
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- version: '0'
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - ">="
263
- - !ruby/object:Gem::Version
264
- version: '0'
265
237
  - !ruby/object:Gem::Dependency
266
238
  name: pry-rails
267
239
  requirement: !ruby/object:Gem::Requirement
@@ -332,62 +304,6 @@ dependencies:
332
304
  - - ">="
333
305
  - !ruby/object:Gem::Version
334
306
  version: '0'
335
- - !ruby/object:Gem::Dependency
336
- name: rubocop
337
- requirement: !ruby/object:Gem::Requirement
338
- requirements:
339
- - - ">="
340
- - !ruby/object:Gem::Version
341
- version: '0'
342
- type: :development
343
- prerelease: false
344
- version_requirements: !ruby/object:Gem::Requirement
345
- requirements:
346
- - - ">="
347
- - !ruby/object:Gem::Version
348
- version: '0'
349
- - !ruby/object:Gem::Dependency
350
- name: rubocop-performance
351
- requirement: !ruby/object:Gem::Requirement
352
- requirements:
353
- - - ">="
354
- - !ruby/object:Gem::Version
355
- version: '0'
356
- type: :development
357
- prerelease: false
358
- version_requirements: !ruby/object:Gem::Requirement
359
- requirements:
360
- - - ">="
361
- - !ruby/object:Gem::Version
362
- version: '0'
363
- - !ruby/object:Gem::Dependency
364
- name: rubocop-rails
365
- requirement: !ruby/object:Gem::Requirement
366
- requirements:
367
- - - ">="
368
- - !ruby/object:Gem::Version
369
- version: '0'
370
- type: :development
371
- prerelease: false
372
- version_requirements: !ruby/object:Gem::Requirement
373
- requirements:
374
- - - ">="
375
- - !ruby/object:Gem::Version
376
- version: '0'
377
- - !ruby/object:Gem::Dependency
378
- name: rubocop-rspec
379
- requirement: !ruby/object:Gem::Requirement
380
- requirements:
381
- - - ">="
382
- - !ruby/object:Gem::Version
383
- version: '0'
384
- type: :development
385
- prerelease: false
386
- version_requirements: !ruby/object:Gem::Requirement
387
- requirements:
388
- - - ">="
389
- - !ruby/object:Gem::Version
390
- version: '0'
391
307
  - !ruby/object:Gem::Dependency
392
308
  name: selenium-webdriver
393
309
  requirement: !ruby/object:Gem::Requirement
@@ -458,20 +374,20 @@ files:
458
374
  - CHANGELOG.md
459
375
  - LICENSE.txt
460
376
  - README.md
377
+ - engine/app/assets/style.css
378
+ - engine/app/assets/vendor/bootstrap/bootstrap-native.js
379
+ - engine/app/assets/vendor/bootstrap/bootstrap.css
380
+ - engine/app/assets/vendor/chartist/chartist.css
381
+ - engine/app/assets/vendor/chartist/chartist.js
461
382
  - engine/app/controllers/good_job/active_jobs_controller.rb
462
383
  - engine/app/controllers/good_job/base_controller.rb
463
384
  - engine/app/controllers/good_job/dashboards_controller.rb
464
385
  - engine/app/helpers/good_job/application_helper.rb
465
- - engine/app/views/assets/_style.css.erb
466
386
  - engine/app/views/good_job/active_jobs/show.html.erb
467
387
  - engine/app/views/good_job/dashboards/index.html.erb
468
388
  - engine/app/views/layouts/good_job/base.html.erb
469
389
  - engine/app/views/shared/_chart.erb
470
390
  - engine/app/views/shared/_jobs_table.erb
471
- - engine/app/views/vendor/bootstrap/_bootstrap-native.js.erb
472
- - engine/app/views/vendor/bootstrap/_bootstrap.css.erb
473
- - engine/app/views/vendor/chartist/_chartist.css.erb
474
- - engine/app/views/vendor/chartist/_chartist.js.erb
475
391
  - engine/config/routes.rb
476
392
  - engine/lib/good_job/engine.rb
477
393
  - exe/good_job