inst-jobs 2.3.1 → 2.3.2

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: 5ab1bd6816331fee7e233542126f85236688fc647050bfc18a1b635e78cd34e5
4
- data.tar.gz: 8b5a8e483f8052ed8a01b77a5a610d06bb9b4f3b59b253982d96c353a24fa113
3
+ metadata.gz: 35a651c7d168b0e569ebc47f13ed3500bd10d813308993ecdbfbc176e74943a5
4
+ data.tar.gz: eba8a2e50f5414684045bde99d5ccc1dc144d00f6b84d3bb82ec5c6becc34003
5
5
  SHA512:
6
- metadata.gz: e1affab489a4655084667dee40a487964da7c50780e7124b15ed18b7319bad1db6606f11bde3e109feef9d09ed94c2fd7d70b5c8f0da049c6f3411f5d9d4bf67
7
- data.tar.gz: eae5d0a5db108e6f0ed92567a466a1663a411fdeac386b159eba906d26f05bea199ef495c020f43ae10d03d6bf6efdfa198e8b39f46caf8d0fb7e8f2a7192704
6
+ metadata.gz: bc667a0ce1380f8acfe092bdf938d06e8d2dfff1018f53679930f88c8ffa45bf088e758fd362f99c5835600527f5a3d2cf189e7560dd6ecce57850d64682f178
7
+ data.tar.gz: 83d984683717018254316d891a972809bf7c3597628d94de149a4af0dab2efe5cf77473a6580408ec461c0d8dddc206b03e8747cbe6f22ba2f169194be876210
@@ -56,6 +56,12 @@ module Delayed
56
56
  kwargs[:expires_at] = expires_at
57
57
  kwargs[:queue] = queue
58
58
 
59
+ strand_args = 0
60
+ strand_args += 1 if strand
61
+ strand_args += 1 if n_strand
62
+ strand_args += 1 if singleton
63
+ raise ArgumentError, "Only one of strand, n_strand, or singleton can be used" if strand_args > 1
64
+
59
65
  # If two parameters are given to n_strand, the first param is used
60
66
  # as the strand name for looking up the Setting, while the second
61
67
  # param is appended to make a unique set of strands.
data/lib/delayed/pool.rb CHANGED
@@ -106,6 +106,7 @@ class Pool
106
106
  # db connections with the parent
107
107
  def fork_with_reconnects
108
108
  fork do
109
+ @self_pipe.each(&:close) # sub-processes don't need to wake us up; keep their FDs clean
109
110
  Pool.on_fork.()
110
111
  Delayed::Job.reconnect!
111
112
  yield
@@ -84,7 +84,7 @@ module Delayed
84
84
  def self.worker_config(config_filename = nil)
85
85
  config_filename ||= default_worker_config_name
86
86
  config = YAML.load(ERB.new(File.read(config_filename)).result)
87
- env = defined?(RAILS_ENV) ? RAILS_ENV : ENV['RAILS_ENV'] || 'development'
87
+ env = Rails.env || 'development'
88
88
  config = config[env] || config['default']
89
89
  # Backwards compatibility from when the config was just an array of queues
90
90
  config = { :workers => config } if config.is_a?(Array)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = "2.3.1"
4
+ VERSION = "2.3.2"
5
5
  end
@@ -16,6 +16,7 @@ class InProcess
16
16
  end
17
17
 
18
18
  # intentional nops for compatibility w/ parent process
19
+ def init; end
19
20
  def close; end
20
21
  def wake_up; end
21
22
  end
@@ -11,7 +11,10 @@ class ParentProcess
11
11
  def initialize(addrinfo, config: Settings.parent_process)
12
12
  @addrinfo = addrinfo
13
13
  @connect_timeout = config['client_connect_timeout'] || 2
14
- @self_pipe = IO.pipe
14
+ end
15
+
16
+ def init
17
+ @self_pipe ||= IO.pipe
15
18
  end
16
19
 
17
20
  def close
@@ -69,7 +69,6 @@ class Worker
69
69
  @config = options
70
70
  @job_count = 0
71
71
 
72
- @self_pipe = IO.pipe
73
72
  @signal_queue = []
74
73
 
75
74
  app = Rails.application
@@ -120,6 +119,8 @@ class Worker
120
119
  def start
121
120
  logger.info "Starting worker"
122
121
  set_process_name("start:#{Settings.worker_procname_prefix}#{@queue_name}:#{min_priority || 0}:#{max_priority || 'max'}")
122
+ @self_pipe = IO.pipe
123
+ work_queue.init
123
124
 
124
125
  work_thread = Thread.current
125
126
  SIGNALS.each do |sig|
@@ -162,6 +163,9 @@ class Worker
162
163
  signal_processor.kill
163
164
  signal_processor.join
164
165
  end
166
+
167
+ @self_pipe&.each(&:close)
168
+ @self_pipe = nil
165
169
  end
166
170
 
167
171
  def cleanup!
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
6
- let(:subject) { described_class.new(addrinfo) }
6
+ let(:subject) { described_class.new(addrinfo).tap(&:init) }
7
7
  let(:addrinfo) { double('Addrinfo') }
8
8
  let(:connection) { double('Socket') }
9
9
  let(:job) { Delayed::Job.new(locked_by: "worker_name") }
@@ -0,0 +1,246 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ inst-jobs (2.3.1)
5
+ activerecord (>= 5.2)
6
+ activesupport (>= 5.2)
7
+ after_transaction_commit (>= 1.0, < 3)
8
+ debug_inspector (~> 1.0)
9
+ fugit (~> 1.3)
10
+ railties (>= 5.2)
11
+ redis (> 3.0)
12
+ redis-scripting (~> 1.0.1)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ actioncable (6.0.3.7)
18
+ actionpack (= 6.0.3.7)
19
+ nio4r (~> 2.0)
20
+ websocket-driver (>= 0.6.1)
21
+ actionmailbox (6.0.3.7)
22
+ actionpack (= 6.0.3.7)
23
+ activejob (= 6.0.3.7)
24
+ activerecord (= 6.0.3.7)
25
+ activestorage (= 6.0.3.7)
26
+ activesupport (= 6.0.3.7)
27
+ mail (>= 2.7.1)
28
+ actionmailer (6.0.3.7)
29
+ actionpack (= 6.0.3.7)
30
+ actionview (= 6.0.3.7)
31
+ activejob (= 6.0.3.7)
32
+ mail (~> 2.5, >= 2.5.4)
33
+ rails-dom-testing (~> 2.0)
34
+ actionpack (6.0.3.7)
35
+ actionview (= 6.0.3.7)
36
+ activesupport (= 6.0.3.7)
37
+ rack (~> 2.0, >= 2.0.8)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.0)
40
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
41
+ actiontext (6.0.3.7)
42
+ actionpack (= 6.0.3.7)
43
+ activerecord (= 6.0.3.7)
44
+ activestorage (= 6.0.3.7)
45
+ activesupport (= 6.0.3.7)
46
+ nokogiri (>= 1.8.5)
47
+ actionview (6.0.3.7)
48
+ activesupport (= 6.0.3.7)
49
+ builder (~> 3.1)
50
+ erubi (~> 1.4)
51
+ rails-dom-testing (~> 2.0)
52
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
53
+ activejob (6.0.3.7)
54
+ activesupport (= 6.0.3.7)
55
+ globalid (>= 0.3.6)
56
+ activemodel (6.0.3.7)
57
+ activesupport (= 6.0.3.7)
58
+ activerecord (6.0.3.7)
59
+ activemodel (= 6.0.3.7)
60
+ activesupport (= 6.0.3.7)
61
+ activestorage (6.0.3.7)
62
+ actionpack (= 6.0.3.7)
63
+ activejob (= 6.0.3.7)
64
+ activerecord (= 6.0.3.7)
65
+ marcel (~> 1.0.0)
66
+ activesupport (6.0.3.7)
67
+ concurrent-ruby (~> 1.0, >= 1.0.2)
68
+ i18n (>= 0.7, < 2)
69
+ minitest (~> 5.1)
70
+ tzinfo (~> 1.1)
71
+ zeitwerk (~> 2.2, >= 2.2.2)
72
+ addressable (2.7.0)
73
+ public_suffix (>= 2.0.2, < 5.0)
74
+ after_transaction_commit (2.2.2)
75
+ activerecord (>= 5.2)
76
+ builder (3.2.4)
77
+ bump (0.10.0)
78
+ byebug (11.1.3)
79
+ coderay (1.1.3)
80
+ concurrent-ruby (1.1.9)
81
+ crack (0.4.5)
82
+ rexml
83
+ crass (1.0.6)
84
+ database_cleaner (2.0.1)
85
+ database_cleaner-active_record (~> 2.0.0)
86
+ database_cleaner-active_record (2.0.0)
87
+ activerecord (>= 5.a)
88
+ database_cleaner-core (~> 2.0.0)
89
+ database_cleaner-core (2.0.1)
90
+ debug_inspector (1.1.0)
91
+ deep_merge (1.2.1)
92
+ diff-lcs (1.4.4)
93
+ diplomat (2.5.1)
94
+ deep_merge (~> 1.2)
95
+ faraday (>= 0.9)
96
+ erubi (1.10.0)
97
+ et-orbi (1.2.4)
98
+ tzinfo
99
+ faraday (1.4.1)
100
+ faraday-excon (~> 1.1)
101
+ faraday-net_http (~> 1.0)
102
+ faraday-net_http_persistent (~> 1.1)
103
+ multipart-post (>= 1.2, < 3)
104
+ ruby2_keywords (>= 0.0.4)
105
+ faraday-excon (1.1.0)
106
+ faraday-net_http (1.0.1)
107
+ faraday-net_http_persistent (1.1.0)
108
+ fugit (1.4.5)
109
+ et-orbi (~> 1.1, >= 1.1.8)
110
+ raabro (~> 1.4)
111
+ globalid (0.4.2)
112
+ activesupport (>= 4.2.0)
113
+ hashdiff (1.0.1)
114
+ i18n (1.8.10)
115
+ concurrent-ruby (~> 1.0)
116
+ loofah (2.10.0)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.5.9)
119
+ mail (2.7.1)
120
+ mini_mime (>= 0.1.1)
121
+ marcel (1.0.1)
122
+ method_source (1.0.0)
123
+ mini_mime (1.1.0)
124
+ minitest (5.14.4)
125
+ multi_json (1.15.0)
126
+ multipart-post (2.1.1)
127
+ mustermann (1.1.1)
128
+ ruby2_keywords (~> 0.0.1)
129
+ nio4r (2.5.7)
130
+ nokogiri (1.11.7-x86_64-darwin)
131
+ racc (~> 1.4)
132
+ pg (1.2.3)
133
+ pry (0.14.1)
134
+ coderay (~> 1.1)
135
+ method_source (~> 1.0)
136
+ public_suffix (4.0.6)
137
+ raabro (1.4.0)
138
+ racc (1.5.2)
139
+ rack (2.2.3)
140
+ rack-protection (2.1.0)
141
+ rack
142
+ rack-test (1.1.0)
143
+ rack (>= 1.0, < 3)
144
+ rails (6.0.3.7)
145
+ actioncable (= 6.0.3.7)
146
+ actionmailbox (= 6.0.3.7)
147
+ actionmailer (= 6.0.3.7)
148
+ actionpack (= 6.0.3.7)
149
+ actiontext (= 6.0.3.7)
150
+ actionview (= 6.0.3.7)
151
+ activejob (= 6.0.3.7)
152
+ activemodel (= 6.0.3.7)
153
+ activerecord (= 6.0.3.7)
154
+ activestorage (= 6.0.3.7)
155
+ activesupport (= 6.0.3.7)
156
+ bundler (>= 1.3.0)
157
+ railties (= 6.0.3.7)
158
+ sprockets-rails (>= 2.0.0)
159
+ rails-dom-testing (2.0.3)
160
+ activesupport (>= 4.2.0)
161
+ nokogiri (>= 1.6)
162
+ rails-html-sanitizer (1.3.0)
163
+ loofah (~> 2.3)
164
+ railties (6.0.3.7)
165
+ actionpack (= 6.0.3.7)
166
+ activesupport (= 6.0.3.7)
167
+ method_source
168
+ rake (>= 0.8.7)
169
+ thor (>= 0.20.3, < 2.0)
170
+ rake (13.0.3)
171
+ redis (4.2.5)
172
+ redis-scripting (1.0.1)
173
+ redis (>= 3.0)
174
+ rexml (3.2.5)
175
+ rspec (3.10.0)
176
+ rspec-core (~> 3.10.0)
177
+ rspec-expectations (~> 3.10.0)
178
+ rspec-mocks (~> 3.10.0)
179
+ rspec-core (3.10.1)
180
+ rspec-support (~> 3.10.0)
181
+ rspec-expectations (3.10.1)
182
+ diff-lcs (>= 1.2.0, < 2.0)
183
+ rspec-support (~> 3.10.0)
184
+ rspec-mocks (3.10.2)
185
+ diff-lcs (>= 1.2.0, < 2.0)
186
+ rspec-support (~> 3.10.0)
187
+ rspec-support (3.10.2)
188
+ ruby2_keywords (0.0.4)
189
+ sinatra (2.1.0)
190
+ mustermann (~> 1.0)
191
+ rack (~> 2.2)
192
+ rack-protection (= 2.1.0)
193
+ tilt (~> 2.0)
194
+ sinatra-contrib (2.1.0)
195
+ multi_json
196
+ mustermann (~> 1.0)
197
+ rack-protection (= 2.1.0)
198
+ sinatra (= 2.1.0)
199
+ tilt (~> 2.0)
200
+ sprockets (4.0.2)
201
+ concurrent-ruby (~> 1.0)
202
+ rack (> 1, < 3)
203
+ sprockets-rails (3.2.2)
204
+ actionpack (>= 4.0)
205
+ activesupport (>= 4.0)
206
+ sprockets (>= 3.0.0)
207
+ thor (1.1.0)
208
+ thread_safe (0.3.6)
209
+ tilt (2.0.10)
210
+ timecop (0.9.4)
211
+ tzinfo (1.2.9)
212
+ thread_safe (~> 0.1)
213
+ webmock (3.13.0)
214
+ addressable (>= 2.3.6)
215
+ crack (>= 0.3.2)
216
+ hashdiff (>= 0.4.0, < 2.0.0)
217
+ websocket-driver (0.7.5)
218
+ websocket-extensions (>= 0.1.0)
219
+ websocket-extensions (0.1.5)
220
+ wwtd (1.4.1)
221
+ zeitwerk (2.4.2)
222
+
223
+ PLATFORMS
224
+ x86_64-darwin-20
225
+
226
+ DEPENDENCIES
227
+ bump
228
+ byebug
229
+ database_cleaner (~> 2.0)
230
+ database_cleaner-active_record (~> 2.0)
231
+ diplomat (~> 2.5.1)
232
+ inst-jobs!
233
+ pg
234
+ pry
235
+ rack-test
236
+ rails (~> 6.0.0)
237
+ rake
238
+ rspec (~> 3.10)
239
+ sinatra (~> 2.0)
240
+ sinatra-contrib (~> 2.0)
241
+ timecop (= 0.9.4)
242
+ webmock
243
+ wwtd (~> 1.4.0)
244
+
245
+ BUNDLED WITH
246
+ 2.2.17
@@ -313,6 +313,13 @@ shared_examples_for 'a backend' do
313
313
  expect(second).to eq nil
314
314
  end
315
315
 
316
+ it "complains if you pass more than one strand-based option" do
317
+ expect { create_job(strand: 'a', n_strand: 'b') }.to raise_error(ArgumentError)
318
+ expect { create_job(strand: 'a', singleton: 'b') }.to raise_error(ArgumentError)
319
+ expect { create_job(n_strand: 'a', singleton: 'b') }.to raise_error(ArgumentError)
320
+ expect { create_job(strand: 'a', n_strand: 'b', singleton: 'c') }.to raise_error(ArgumentError)
321
+ end
322
+
316
323
  context 'singleton' do
317
324
  it "should create if there's no jobs on the strand" do
318
325
  @job = create_job(:singleton => 'myjobs')
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  - Brian Palmer
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-05-24 00:00:00.000000000 Z
12
+ date: 2021-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -353,7 +353,7 @@ dependencies:
353
353
  - - "~>"
354
354
  - !ruby/object:Gem::Version
355
355
  version: 1.4.0
356
- description:
356
+ description:
357
357
  email:
358
358
  - brianp@instructure.com
359
359
  executables:
@@ -452,6 +452,7 @@ files:
452
452
  - spec/delayed/worker_spec.rb
453
453
  - spec/gemfiles/52.gemfile
454
454
  - spec/gemfiles/60.gemfile
455
+ - spec/gemfiles/60.gemfile.lock
455
456
  - spec/gemfiles/61.gemfile
456
457
  - spec/migrate/20140924140513_add_story_table.rb
457
458
  - spec/redis_job_spec.rb
@@ -467,7 +468,7 @@ files:
467
468
  homepage: https://github.com/instructure/inst-jobs
468
469
  licenses: []
469
470
  metadata: {}
470
- post_install_message:
471
+ post_install_message:
471
472
  rdoc_options: []
472
473
  require_paths:
473
474
  - lib
@@ -482,14 +483,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
482
483
  - !ruby/object:Gem::Version
483
484
  version: '0'
484
485
  requirements: []
485
- rubygems_version: 3.2.15
486
- signing_key:
486
+ rubygems_version: 3.0.3
487
+ signing_key:
487
488
  specification_version: 4
488
489
  summary: Instructure-maintained fork of delayed_job
489
490
  test_files:
490
491
  - spec/sample_jobs.rb
491
492
  - spec/spec_helper.rb
492
493
  - spec/redis_job_spec.rb
494
+ - spec/gemfiles/60.gemfile.lock
493
495
  - spec/gemfiles/61.gemfile
494
496
  - spec/gemfiles/60.gemfile
495
497
  - spec/gemfiles/52.gemfile