inst-jobs 3.1.13 → 3.1.15

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: 2342458023c7d56e82311cd05089b8a748c266b462289a5ce5ba9c169a89abbe
4
- data.tar.gz: b9cf5ced42b4a1d18f3599203c55683218c94d71c9f5671db58c8c49ba502ef6
3
+ metadata.gz: 61efa120190f5afebc7aa06c5d78f3b746307bcee1986c814cc317056e916361
4
+ data.tar.gz: 8fe59b557d2847a2def469bf46d1d01230fbfc02ccebe7c8604d53352aebf819
5
5
  SHA512:
6
- metadata.gz: 5b234730e2acb907a880e564b8e7036ff64e9b3d09c18426779c125e7f7c2dbc83629d1c11157131137b0902a128f1a3cfba968e611a77e82782adabfdca6d96
7
- data.tar.gz: d3487c737f65ced442c1219ae929eefd1247bb5753f345d06991634262fa592671ea37c798044b0477f038b2e2958c083bc38b9c5b4d344e9a557ec450cfb400
6
+ metadata.gz: eae3cc53632c5064023a345cde20acdfa69a86156f19f001f881dc19a0843cf546d2676b9cff2158e2344f5fbd6c867be214c47ae89679c7412144630ba08160
7
+ data.tar.gz: 49a1d5a7f56f0f344add67add41e21c524ca0688402708910f9fd04c13336d69d7623d05e22588f4407e805c8f67ee87519aeb8304f92191510f64ed72975308
@@ -25,6 +25,8 @@ module Delayed
25
25
  include Delayed::Backend::Base
26
26
  self.table_name = :delayed_jobs
27
27
 
28
+ attr_accessor :enqueue_result
29
+
28
30
  scope :next_in_strand_order, -> { order(:strand_order_override, :id) }
29
31
 
30
32
  def self.reconnect!
@@ -106,7 +108,8 @@ module Delayed
106
108
  end
107
109
 
108
110
  # https://www.postgresql.org/docs/9.5/libpq-exec.html
109
- sql << " RETURNING id"
111
+ # https://stackoverflow.com/questions/39058213/differentiate-inserted-and-updated-rows-in-upsert-using-system-columns
112
+ sql << " RETURNING id, (xmax = 0) AS inserted"
110
113
 
111
114
  if lock_and_insert
112
115
  # > Multiple queries sent in a single PQexec call are processed in a single transaction,
@@ -120,12 +123,22 @@ module Delayed
120
123
  end
121
124
  result = connection.execute(sql, "#{self.class} Create")
122
125
  self.id = result.values.first&.first
126
+ inserted = result.values.first&.second
123
127
  result.clear
124
128
  else
125
129
  result = connection.exec_query(sql, "#{self.class} Create", binds)
126
130
  self.id = connection.send(:last_inserted_id, result)
131
+ inserted = result.rows.first&.second
127
132
  end
128
133
 
134
+ self.enqueue_result = if id.present? && inserted
135
+ :inserted
136
+ elsif id.present? && !inserted
137
+ :updated
138
+ else
139
+ :dropped
140
+ end
141
+
129
142
  # it might not get set if there was an existing record, and we didn't update it
130
143
  if id
131
144
  @new_record = false
@@ -3,7 +3,12 @@
3
3
  module Delayed
4
4
  class LogTailer
5
5
  def run
6
- if Rails.logger.respond_to?(:log_path)
6
+ if Rails.logger.respond_to?(:broadcast_to)
7
+ return if ActiveSupport::Logger.logger_outputs_to?(Rails.logger, $stdout)
8
+
9
+ Rails.logger.broadcast_to(ActiveSupport::Logger.new($stdout))
10
+ return
11
+ elsif Rails.logger.respond_to?(:log_path)
7
12
  log_path = Rails.logger.log_path
8
13
  elsif Rails.logger.instance_variable_get(:@logdev).try(:instance_variable_get, "@dev").try(:path)
9
14
  log_path = Rails.logger.instance_variable_get(:@logdev).instance_variable_get(:@dev).path
@@ -94,7 +94,7 @@ module Delayed
94
94
  def __calculate_sender_for_delay
95
95
  # enforce public send in dev and test, but not prod (since it uses
96
96
  # debug APIs, it's expensive)
97
- return sender(1) if ::Rails.env.test? || ::Rails.env.development?
97
+ sender(1) if ::Rails.env.test? || ::Rails.env.development?
98
98
  end
99
99
 
100
100
  module ClassMethods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = "3.1.13"
4
+ VERSION = "3.1.15"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.13
4
+ version: 3.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-09-08 00:00:00.000000000 Z
13
+ date: 2024-03-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -116,20 +116,6 @@ dependencies:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '6.0'
119
- - !ruby/object:Gem::Dependency
120
- name: appraisal
121
- requirement: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '2.4'
126
- type: :development
127
- prerelease: false
128
- version_requirements: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '2.4'
133
119
  - !ruby/object:Gem::Dependency
134
120
  name: bump
135
121
  requirement: !ruby/object:Gem::Requirement
@@ -242,20 +228,6 @@ dependencies:
242
228
  - - ">="
243
229
  - !ruby/object:Gem::Version
244
230
  version: '0'
245
- - !ruby/object:Gem::Dependency
246
- name: rails
247
- requirement: !ruby/object:Gem::Requirement
248
- requirements:
249
- - - ">="
250
- - !ruby/object:Gem::Version
251
- version: '0'
252
- type: :development
253
- prerelease: false
254
- version_requirements: !ruby/object:Gem::Requirement
255
- requirements:
256
- - - ">="
257
- - !ruby/object:Gem::Version
258
- version: '0'
259
231
  - !ruby/object:Gem::Dependency
260
232
  name: rake
261
233
  requirement: !ruby/object:Gem::Requirement
@@ -372,16 +344,16 @@ dependencies:
372
344
  name: timecop
373
345
  requirement: !ruby/object:Gem::Requirement
374
346
  requirements:
375
- - - '='
347
+ - - "~>"
376
348
  - !ruby/object:Gem::Version
377
- version: 0.9.4
349
+ version: '0.9'
378
350
  type: :development
379
351
  prerelease: false
380
352
  version_requirements: !ruby/object:Gem::Requirement
381
353
  requirements:
382
- - - '='
354
+ - - "~>"
383
355
  - !ruby/object:Gem::Version
384
- version: 0.9.4
356
+ version: '0.9'
385
357
  - !ruby/object:Gem::Dependency
386
358
  name: webmock
387
359
  requirement: !ruby/object:Gem::Requirement