inst-jobs 2.4.9 → 2.4.10

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: 8e17453e7b2cfd39920dfb36c615bcd813ecf3416985e405e26d5062716ccaa7
4
- data.tar.gz: 17ad240a2304ca6ee648308199ac8d83d53498ee93cd130bf3cbd86dde729673
3
+ metadata.gz: 65052c093825ca46de07a054fc2b62925cf2d1cb0a3fcb877b408e5c88edc865
4
+ data.tar.gz: '08d1c103f2c41f11f5989a0b5e2bb857e7d8ea250ba995dcd1ddae62510426cf'
5
5
  SHA512:
6
- metadata.gz: 29ed31003455122f52a8f45ac22751acf3f71213e4f93fae280425d90f5a35919ef881220660c453469904cec107383d0764afa0d87458da3b4fdded272c5c78
7
- data.tar.gz: a9cb6ff603ad8c683b326cebfdb24acef31a450f3e6fab88af3760adf8f726e4c4dc28797bbcb7bb5e38b0f2fef0af97ee3c145a8031db723e5c67bb9c94d385
6
+ metadata.gz: 3e28511d5c23fcdccd976e9d8f9f09ae318c50154d01223b84b3f60de42e34dbb55ed6735618224865b8c8050e15eed78bd9c8505b85abb56515c41c4266c985
7
+ data.tar.gz: bc60ce604e1b5077251c1c5855a3bd0582950c03c0ed0423b0daf25e8750d6e2f6dfbb32b18e99ace156a1a5232ac8e827377997185bd8c4889abe20e6e7249b
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = "2.4.9"
4
+ VERSION = "2.4.10"
5
5
  end
@@ -179,7 +179,7 @@ module Delayed
179
179
  end
180
180
 
181
181
  jobs_to_send.each do |(recipient, job_to_send)|
182
- @waiting_clients[worker_config].delete(client)
182
+ @waiting_clients[worker_config].delete(recipient)
183
183
  begin
184
184
  logger.debug("Sending job #{job_to_send.id} to #{recipient.name}")
185
185
  client_timeout { Marshal.dump(job_to_send, recipient.socket) }
@@ -24,6 +24,10 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Server do
24
24
  let(:args) { ["worker_name", worker_config] }
25
25
  let(:job_args) { [["worker_name"], "queue_name", 1, 2, hash_including(prefetch: 4)] }
26
26
 
27
+ before do
28
+ Delayed::Worker.lifecycle.reset!
29
+ end
30
+
27
31
  before :all do
28
32
  Delayed.select_backend(Delayed::Backend::ActiveRecord::Job)
29
33
  Delayed::Settings.parent_process = {
@@ -37,6 +41,7 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Server do
37
41
 
38
42
  after do
39
43
  File.unlink("/tmp/inst-jobs-test.sock") if File.exist?("/tmp/inst-jobs-test.sock")
44
+ Delayed::Worker.lifecycle.reset!
40
45
  end
41
46
 
42
47
  it "accepts new clients" do
@@ -205,4 +210,24 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Server do
205
210
  expect(Marshal.load(client)).to eq(job)
206
211
  expect(called).to eq(true)
207
212
  end
213
+
214
+ it "deletes the correct worker when transferring jobs" do
215
+ client1 = Socket.unix(subject.listen_socket.local_address.unix_path)
216
+ client2 = Socket.unix(subject.listen_socket.local_address.unix_path)
217
+ subject.run_once
218
+ subject.run_once
219
+
220
+ Marshal.dump(args, client1)
221
+ Marshal.dump(["worker_name2", worker_config], client2)
222
+ subject.run_once
223
+ subject.run_once
224
+
225
+ waiting_clients = subject.instance_variable_get(:@waiting_clients)
226
+ expect(waiting_clients.first.last.length).to eq 2
227
+
228
+ expect(Delayed::Job).to receive(:get_and_lock_next_available).and_return("worker_name" => job,
229
+ "worker_name2" => job)
230
+ subject.run_once
231
+ expect(waiting_clients.first.last).to be_empty
232
+ end
208
233
  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: 2.4.9
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke