faktory_worker_ruby 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +29 -0
- data/Changes.md +4 -0
- data/Gemfile.lock +20 -19
- data/README.md +1 -1
- data/lib/faktory/client.rb +2 -0
- data/lib/faktory/io.rb +2 -2
- data/lib/faktory/job.rb +24 -1
- data/lib/faktory/version.rb +1 -1
- metadata +3 -3
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ba3a7a6dbf71b034a2e9a209830f3049132c72b12105262b6ce971df9e602e6
|
4
|
+
data.tar.gz: f0adb0757fdaed227ec36d13786dadf7a9e39b6854589f4c25e65a8c9101cf86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89471fb1dfd8624f9b562c773909378b4c40a4b52fd7dd198b7d2808199b2057a760b2cbcd919b8aa4494569979092c53762dd24e57be6ecfe7143a97540521d
|
7
|
+
data.tar.gz: 734b8145a57e435ecac307006723608998958bd9952a194c804fe033681579530d0ccc84ed591ffe8cfbbc5393abe4bd6b95045c49d02ceb3c87f742f6027905
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby: [2.5, 2.6, 2.7, '3.0']
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
services:
|
17
|
+
faktory:
|
18
|
+
image: contribsys/faktory:latest
|
19
|
+
ports:
|
20
|
+
- 7419:7419
|
21
|
+
- 7420:7420
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
- uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
bundler-cache: true
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
- run: bundle install
|
29
|
+
- run: bundle exec rake
|
data/Changes.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -7,34 +7,35 @@ PATH
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activejob (6.
|
11
|
-
activesupport (= 6.
|
10
|
+
activejob (6.1.3.2)
|
11
|
+
activesupport (= 6.1.3.2)
|
12
12
|
globalid (>= 0.3.6)
|
13
|
-
activesupport (6.
|
13
|
+
activesupport (6.1.3.2)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
18
|
-
zeitwerk (~> 2.
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
connection_pool (2.2.
|
21
|
-
docile (1.
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
zeitwerk (~> 2.3)
|
19
|
+
concurrent-ruby (1.1.9)
|
20
|
+
connection_pool (2.2.5)
|
21
|
+
docile (1.4.0)
|
22
22
|
globalid (0.4.2)
|
23
23
|
activesupport (>= 4.2.0)
|
24
|
-
i18n (1.8.
|
24
|
+
i18n (1.8.10)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
|
-
minitest (5.14.
|
26
|
+
minitest (5.14.4)
|
27
27
|
minitest-hooks (1.5.0)
|
28
28
|
minitest (> 5.3)
|
29
|
-
rake (13.0.
|
30
|
-
simplecov (0.
|
29
|
+
rake (13.0.3)
|
30
|
+
simplecov (0.21.2)
|
31
31
|
docile (~> 1.1)
|
32
32
|
simplecov-html (~> 0.11)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
simplecov_json_formatter (~> 0.1)
|
34
|
+
simplecov-html (0.12.3)
|
35
|
+
simplecov_json_formatter (0.1.3)
|
36
|
+
tzinfo (2.0.4)
|
37
|
+
concurrent-ruby (~> 1.0)
|
38
|
+
zeitwerk (2.4.2)
|
38
39
|
|
39
40
|
PLATFORMS
|
40
41
|
ruby
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# faktory\_worker\_ruby
|
2
2
|
|
3
|
-

|
4
4
|
|
5
5
|
Faktory\_worker\_ruby is the official Ruby client and worker process for the
|
6
6
|
Faktory background job server. It is similar to [Sidekiq](http://sidekiq.org).
|
data/lib/faktory/client.rb
CHANGED
@@ -241,6 +241,7 @@ module Faktory
|
|
241
241
|
|
242
242
|
def open(timeout = DEFAULT_TIMEOUT)
|
243
243
|
if tls?
|
244
|
+
require 'openssl'
|
244
245
|
sock = TCPSocket.new(@location.hostname, @location.port)
|
245
246
|
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
|
246
247
|
|
@@ -262,6 +263,7 @@ module Faktory
|
|
262
263
|
"hostname": Socket.gethostname,
|
263
264
|
"pid": $$,
|
264
265
|
"labels": Faktory.options[:labels] || ["ruby-#{RUBY_VERSION}"],
|
266
|
+
"username": @location.user,
|
265
267
|
"v": 2,
|
266
268
|
}
|
267
269
|
|
data/lib/faktory/io.rb
CHANGED
@@ -37,9 +37,9 @@ module Faktory
|
|
37
37
|
loop do
|
38
38
|
result = @sock.read_nonblock(nbytes, exception: false)
|
39
39
|
if result == :wait_readable
|
40
|
-
raise Faktory::TimeoutError unless @sock.wait_readable(@timeout)
|
40
|
+
raise Faktory::TimeoutError unless @sock.to_io.wait_readable(@timeout)
|
41
41
|
elsif result == :wait_writable
|
42
|
-
raise Faktory::TimeoutError unless @sock.wait_writeable(@timeout)
|
42
|
+
raise Faktory::TimeoutError unless @sock.to_io.wait_writeable(@timeout)
|
43
43
|
elsif result == nil
|
44
44
|
raise Errno::ECONNRESET
|
45
45
|
else
|
data/lib/faktory/job.rb
CHANGED
@@ -56,6 +56,11 @@ module Faktory
|
|
56
56
|
@opts = opts
|
57
57
|
end
|
58
58
|
|
59
|
+
def set(opts)
|
60
|
+
@opts = Util.deep_merge(@opts, opts)
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
59
64
|
def perform_async(*args)
|
60
65
|
client_push(@opts.merge('args'.freeze => args))
|
61
66
|
end
|
@@ -104,7 +109,7 @@ module Faktory
|
|
104
109
|
module ClassMethods
|
105
110
|
|
106
111
|
def set(options)
|
107
|
-
Setter.new(
|
112
|
+
Setter.new(Util.deep_merge(get_faktory_options, options, 'jobtype'.freeze => self))
|
108
113
|
end
|
109
114
|
|
110
115
|
def perform_async(*args)
|
@@ -193,5 +198,23 @@ module Faktory
|
|
193
198
|
end
|
194
199
|
|
195
200
|
end
|
201
|
+
|
202
|
+
module Util
|
203
|
+
def deep_merge(*hashes)
|
204
|
+
initial = hashes.shift.transform_keys(&:to_s)
|
205
|
+
hashes.reduce(initial) do |acc, other_hash|
|
206
|
+
other_hash.transform_keys!(&:to_s)
|
207
|
+
acc.merge(other_hash) do |_key, this_val, other_val|
|
208
|
+
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
209
|
+
deep_merge(this_val, other_val)
|
210
|
+
else
|
211
|
+
other_val
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
module_function :deep_merge
|
217
|
+
end
|
218
|
+
|
196
219
|
end
|
197
220
|
end
|
data/lib/faktory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faktory_worker_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -94,8 +94,8 @@ executables:
|
|
94
94
|
extensions: []
|
95
95
|
extra_rdoc_files: []
|
96
96
|
files:
|
97
|
+
- ".github/workflows/ci.yml"
|
97
98
|
- ".gitignore"
|
98
|
-
- ".travis.yml"
|
99
99
|
- Changes.md
|
100
100
|
- Gemfile
|
101
101
|
- Gemfile.lock
|
data/.travis.yml
DELETED