inst-jobs 2.4.9 → 2.4.11

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: 207f92edc1bf044fe040fac47e1eb3eff01d8d11ff66f3a5fa3ff3429ffca748
4
+ data.tar.gz: 0aa8bb0e7c81fe22eca78171b6827ba84f325e2981cda075691072f4305a355d
5
5
  SHA512:
6
- metadata.gz: 29ed31003455122f52a8f45ac22751acf3f71213e4f93fae280425d90f5a35919ef881220660c453469904cec107383d0764afa0d87458da3b4fdded272c5c78
7
- data.tar.gz: a9cb6ff603ad8c683b326cebfdb24acef31a450f3e6fab88af3760adf8f726e4c4dc28797bbcb7bb5e38b0f2fef0af97ee3c145a8031db723e5c67bb9c94d385
6
+ metadata.gz: d9278910b958ca2854c7b3d5e10a0b3911ee14938067897abb166929db2888f8577d8507622e372b12a5e5db53fbb09d50d5bdcea591364ca5b40ab7a46d1a27
7
+ data.tar.gz: 9b4b76b471d442e102a217d16d426dc0eed0e3e2a9bded47cc5d8505806264f189629cea337d084f0300398b96c52f9036a6670aa4b5ef426fff9f56775001a0
data/exe/inst_jobs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative "config/environment"
4
+ require File.expand_path("config/environment")
5
5
  Delayed::CLI.new.run
@@ -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.11"
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,15 +1,15 @@
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.11
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-09-28 00:00:00.000000000 Z
12
+ date: 2023-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -395,7 +395,7 @@ dependencies:
395
395
  - - "~>"
396
396
  - !ruby/object:Gem::Version
397
397
  version: 1.4.0
398
- description:
398
+ description:
399
399
  email:
400
400
  - brianp@instructure.com
401
401
  executables:
@@ -498,7 +498,7 @@ files:
498
498
  homepage: https://github.com/instructure/inst-jobs
499
499
  licenses: []
500
500
  metadata: {}
501
- post_install_message:
501
+ post_install_message:
502
502
  rdoc_options: []
503
503
  require_paths:
504
504
  - lib
@@ -513,8 +513,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
513
  - !ruby/object:Gem::Version
514
514
  version: '0'
515
515
  requirements: []
516
- rubygems_version: 3.2.24
517
- signing_key:
516
+ rubygems_version: 3.1.6
517
+ signing_key:
518
518
  specification_version: 4
519
519
  summary: Instructure-maintained fork of delayed_job
520
520
  test_files: