inst-jobs 0.13.5 → 0.13.6

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
  SHA1:
3
- metadata.gz: 6a6fbdeb269f4f69f782600a64e9f98eeb7c788b
4
- data.tar.gz: ada970af5b83314a5c242c826f880af2808a16e7
3
+ metadata.gz: b63744bcf8a08c33dca7774529b4a20fb919771d
4
+ data.tar.gz: 4c5a5a634d64817e7ac47bc01182228d2b0a3c93
5
5
  SHA512:
6
- metadata.gz: c802d32a04ee4c5fc7c3000d0da1a16b4ac1f6badafa96b5163cf9683d02d777398504fd2b8e3649ce0313397e12c4e08aabedf21a41c58c0fdcd77af8b85a1c
7
- data.tar.gz: bab3104244bfd19656440c748e17be05ecbde32064f92d600798475a78661e3c066f289f25fcb7ecab661e4a09ccaa343348dffe0e40ce9dd82e9a5a9135e5b4
6
+ metadata.gz: 217273201d1fd055e55c711e52d101051afd404b1b6dc75443901b4add9b03433e2c8e50bbaaa4d162defd321b7da911c5fafc9ba25fb2ac6541983f6070ec4e
7
+ data.tar.gz: 76ad540b9e89b1c5e60265cb4c5aa18c463eb51810f4c965546da578005759ba09bfdeb429e92b8dd7b1d4aedab117489ba4a3c84e4fb24f1bbbfb8a1abf1b4e
data/lib/delayed/cli.rb CHANGED
@@ -2,7 +2,15 @@ require 'optparse'
2
2
 
3
3
  module Delayed
4
4
  class CLI
5
+ class << self
6
+ attr_accessor :instance
7
+ end
8
+
9
+ attr_reader :config
10
+
5
11
  def initialize(args = ARGV)
12
+ self.class.instance = self
13
+
6
14
  @args = args
7
15
  # config that will be applied on Settings and passed to the created Pool
8
16
  @config = {}
@@ -1,3 +1,3 @@
1
1
  module Delayed
2
- VERSION = "0.13.5"
2
+ VERSION = "0.13.6"
3
3
  end
@@ -122,6 +122,8 @@ class ParentProcess
122
122
  next if workers.empty?
123
123
 
124
124
  logger.debug("Fetching new work for #{workers.length} workers")
125
+ jobs_to_send = []
126
+
125
127
  Delayed::Worker.lifecycle.run_callbacks(:work_queue_pop, self, worker_config) do
126
128
  recipients = workers.map(&:name)
127
129
 
@@ -142,15 +144,19 @@ class ParentProcess
142
144
  end
143
145
  client = workers.find { |worker| worker.name == worker_name }
144
146
  client.working = true
145
- @waiting_clients[worker_config].delete(client)
146
- begin
147
- logger.debug("Sending job #{job.id} to #{client.name}")
148
- client_timeout { Marshal.dump(job, client.socket) }
149
- rescue SystemCallError, IOError, Timeout::Error => ex
150
- logger.error("Failed to send job to #{client.name}: #{ex.inspect}")
151
- drop_socket(client.socket)
152
- Delayed::Job.unlock([job])
153
- end
147
+ jobs_to_send << [client, job]
148
+ end
149
+ end
150
+
151
+ jobs_to_send.each do |(client, job)|
152
+ @waiting_clients[worker_config].delete(client)
153
+ begin
154
+ logger.debug("Sending job #{job.id} to #{client.name}")
155
+ client_timeout { Marshal.dump(job, client.socket) }
156
+ rescue SystemCallError, IOError, Timeout::Error => ex
157
+ logger.error("Failed to send job to #{client.name}: #{ex.inspect}")
158
+ drop_socket(client.socket)
159
+ Delayed::Job.unlock([job])
154
160
  end
155
161
  end
156
162
  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: 0.13.5
4
+ version: 0.13.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-14 00:00:00.000000000 Z
12
+ date: 2017-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: after_transaction_commit