fleiss 0.4.3 → 0.4.4
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/Gemfile.lock +16 -16
- data/fleiss.gemspec +1 -1
- data/lib/active_job/queue_adapters/fleiss_adapter.rb +2 -2
- data/lib/fleiss/backend/active_record/concern.rb +1 -1
- data/lib/fleiss/worker.rb +8 -10
- data/spec/fleiss/backend/active_record_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee721d0d8b4ceb6a3308ded176bac0cbb64aafe602bf4aacda952d9440cff486
|
4
|
+
data.tar.gz: 93f4afd58038d95d24bb75640fc96b613a7eac6a421e18852ade1e25ad9df76b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '078d55bb3edf9c2419fbbd7c1906195019e50b356301cb2a4570645b5abae563975f6c0ea6d0632ce039f87c7faddb10b9a21170a0486e06011606a4c4039899'
|
7
|
+
data.tar.gz: cbe4badf9b18b68b9e664ed9bd9a0ec2e1021dfe5ea088ae6a404e6938e325f92fffdb1d24ee8c642b103cdf847272fa85ff2e057c120ee01ce6be8a6d78aed1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fleiss (0.4.
|
4
|
+
fleiss (0.4.4)
|
5
5
|
activejob (>= 6.0)
|
6
6
|
activerecord (>= 6.0)
|
7
7
|
concurrent-ruby
|
@@ -9,15 +9,15 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activejob (6.1.4)
|
13
|
-
activesupport (= 6.1.4)
|
12
|
+
activejob (6.1.4.1)
|
13
|
+
activesupport (= 6.1.4.1)
|
14
14
|
globalid (>= 0.3.6)
|
15
|
-
activemodel (6.1.4)
|
16
|
-
activesupport (= 6.1.4)
|
17
|
-
activerecord (6.1.4)
|
18
|
-
activemodel (= 6.1.4)
|
19
|
-
activesupport (= 6.1.4)
|
20
|
-
activesupport (6.1.4)
|
15
|
+
activemodel (6.1.4.1)
|
16
|
+
activesupport (= 6.1.4.1)
|
17
|
+
activerecord (6.1.4.1)
|
18
|
+
activemodel (= 6.1.4.1)
|
19
|
+
activesupport (= 6.1.4.1)
|
20
|
+
activesupport (6.1.4.1)
|
21
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
22
|
i18n (>= 1.6, < 2)
|
23
23
|
minitest (>= 5.1)
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
ast (2.4.2)
|
27
27
|
concurrent-ruby (1.1.9)
|
28
28
|
diff-lcs (1.4.4)
|
29
|
-
globalid (0.5.
|
29
|
+
globalid (0.5.2)
|
30
30
|
activesupport (>= 5.0)
|
31
31
|
i18n (1.8.10)
|
32
32
|
concurrent-ruby (~> 1.0)
|
33
33
|
minitest (5.14.4)
|
34
34
|
mysql2 (0.5.3)
|
35
|
-
parallel (1.
|
35
|
+
parallel (1.21.0)
|
36
36
|
parser (3.0.2.0)
|
37
37
|
ast (~> 2.4.1)
|
38
38
|
pg (1.2.3)
|
@@ -53,23 +53,23 @@ GEM
|
|
53
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
54
|
rspec-support (~> 3.10.0)
|
55
55
|
rspec-support (3.10.2)
|
56
|
-
rubocop (1.
|
56
|
+
rubocop (1.21.0)
|
57
57
|
parallel (~> 1.10)
|
58
58
|
parser (>= 3.0.0.0)
|
59
59
|
rainbow (>= 2.2.2, < 4.0)
|
60
60
|
regexp_parser (>= 1.8, < 3.0)
|
61
61
|
rexml
|
62
|
-
rubocop-ast (>= 1.
|
62
|
+
rubocop-ast (>= 1.9.1, < 2.0)
|
63
63
|
ruby-progressbar (~> 1.7)
|
64
64
|
unicode-display_width (>= 1.4.0, < 3.0)
|
65
|
-
rubocop-ast (1.
|
65
|
+
rubocop-ast (1.11.0)
|
66
66
|
parser (>= 3.0.1.1)
|
67
67
|
rubocop-bsm (0.6.0)
|
68
68
|
rubocop (~> 1.0)
|
69
69
|
rubocop-performance
|
70
70
|
rubocop-rake
|
71
71
|
rubocop-rspec
|
72
|
-
rubocop-performance (1.11.
|
72
|
+
rubocop-performance (1.11.5)
|
73
73
|
rubocop (>= 1.7.0, < 2.0)
|
74
74
|
rubocop-ast (>= 0.4.0)
|
75
75
|
rubocop-rake (0.6.0)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
sqlite3 (1.4.2)
|
82
82
|
tzinfo (2.0.4)
|
83
83
|
concurrent-ruby (~> 1.0)
|
84
|
-
unicode-display_width (2.
|
84
|
+
unicode-display_width (2.1.0)
|
85
85
|
zeitwerk (2.4.2)
|
86
86
|
|
87
87
|
PLATFORMS
|
data/fleiss.gemspec
CHANGED
@@ -3,11 +3,11 @@ require 'fleiss'
|
|
3
3
|
module ActiveJob
|
4
4
|
module QueueAdapters
|
5
5
|
class FleissAdapter
|
6
|
-
def enqueue(job)
|
6
|
+
def enqueue(job) # :nodoc:
|
7
7
|
enqueue_at(job, nil)
|
8
8
|
end
|
9
9
|
|
10
|
-
def enqueue_at(job, scheduled_at)
|
10
|
+
def enqueue_at(job, scheduled_at) # :nodoc:
|
11
11
|
job_id = Fleiss.backend.enqueue(job, scheduled_at: scheduled_at)
|
12
12
|
job.provider_job_id = job_id
|
13
13
|
job_id
|
data/lib/fleiss/worker.rb
CHANGED
@@ -11,8 +11,6 @@ class Fleiss::Worker
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# Init a new worker instance
|
14
|
-
# @param [ConnectionPool] disque client connection pool
|
15
|
-
# @param [Hash] options
|
16
14
|
# @option [Array<String>] :queues queues to watch. Default: ["default"]
|
17
15
|
# @option [Integer] :concurrency the number of concurrent pool. Default: 10
|
18
16
|
# @option [Numeric] :wait_time maximum time (in seconds) to wait for jobs when retrieving next batch. Default: 1s.
|
@@ -62,16 +60,18 @@ class Fleiss::Worker
|
|
62
60
|
|
63
61
|
batch.each do |job|
|
64
62
|
@pool.post do
|
65
|
-
|
63
|
+
thread_id = Thread.current.object_id.to_s(16).reverse
|
64
|
+
Fleiss.backend.wrap_perform { perform(job, thread_id) }
|
65
|
+
rescue StandardError => e
|
66
|
+
log_exception e, "processing job ##{job.id} (by thread #{thread_id})"
|
66
67
|
end
|
67
68
|
end
|
68
69
|
rescue StandardError => e
|
69
|
-
|
70
|
+
log_exception e, 'running cycle'
|
70
71
|
end
|
71
72
|
|
72
|
-
def perform(job)
|
73
|
-
|
74
|
-
owner = "#{uuid}/#{thread_id}"
|
73
|
+
def perform(job, thread_id)
|
74
|
+
owner = "#{uuid}/#{thread_id}"
|
75
75
|
return unless job.start(owner)
|
76
76
|
|
77
77
|
log(:info) { "Worker #{uuid} execute job ##{job.id} (by thread #{thread_id})" }
|
@@ -85,11 +85,9 @@ class Fleiss::Worker
|
|
85
85
|
ensure
|
86
86
|
finished ? job.finish(owner) : job.reschedule(owner)
|
87
87
|
end
|
88
|
-
rescue StandardError => e
|
89
|
-
handle_exception e, "processing job ##{job.id} (by thread #{thread_id})"
|
90
88
|
end
|
91
89
|
|
92
|
-
def
|
90
|
+
def log_exception(err, intro)
|
93
91
|
log(:error) do
|
94
92
|
[
|
95
93
|
"Worker #{uuid} error on #{intro}:",
|
@@ -125,7 +125,7 @@ RSpec.describe Fleiss::Backend::ActiveRecord do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'reconnects' do
|
128
|
-
expect(::ActiveRecord::Base).to receive(:
|
128
|
+
expect(::ActiveRecord::Base).to receive(:clear_all_connections!).once.and_return(nil)
|
129
129
|
|
130
130
|
expect do
|
131
131
|
described_class.wrap_perform { raise ::ActiveRecord::StatementInvalid }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fleiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|