toiler 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toiler/actor/fetcher.rb +5 -5
- data/lib/toiler/actor/processor.rb +6 -2
- data/lib/toiler/cli.rb +12 -1
- data/lib/toiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d030131a9e4ff1e343b3373d5264af15f561b22
|
4
|
+
data.tar.gz: a91cc26000f04e3bc252b04f070cedb770c32594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236874a8f2aa487999e21af93d0df6d0c8089130c98aac21c055943f807bec2a36dfc761387963d71a8e579010fe8340e3377ac66d6d78e8f31155b3470e72c1
|
7
|
+
data.tar.gz: 9ceac56d2e4c299b4e244e69beb2d8f1a1af6669a343c75ae81d7417d0f924793a8352705b335564694eb5d3a674abd4556c94db96d4c47ccc30173023d7e236
|
data/lib/toiler/actor/fetcher.rb
CHANGED
@@ -7,7 +7,7 @@ module Toiler
|
|
7
7
|
class Fetcher < Concurrent::Actor::RestartingContext
|
8
8
|
include Utils::ActorLogging
|
9
9
|
|
10
|
-
FETCH_LIMIT = 10
|
10
|
+
FETCH_LIMIT = 10
|
11
11
|
|
12
12
|
attr_accessor :queue, :wait, :visibility_timeout, :free_processors,
|
13
13
|
:scheduled
|
@@ -24,7 +24,7 @@ module Toiler
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def default_executor
|
27
|
-
Concurrent.
|
27
|
+
Concurrent.global_io_executor
|
28
28
|
end
|
29
29
|
|
30
30
|
def on_message(msg)
|
@@ -59,10 +59,10 @@ module Toiler
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def poll_messages
|
62
|
-
poll_future.on_completion! do |_success, msgs
|
63
|
-
scheduled.make_false
|
62
|
+
poll_future.on_completion! do |_success, msgs|
|
64
63
|
tell [:assign_messages, msgs] unless msgs.nil? || msgs.empty?
|
65
|
-
|
64
|
+
scheduled.make_false
|
65
|
+
tell :schedule_poll
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -78,8 +78,12 @@ module Toiler
|
|
78
78
|
interval = queue_visibility - 5
|
79
79
|
Concurrent::TimerTask.execute execution_interval: interval,
|
80
80
|
timeout_interval: interval do
|
81
|
-
|
82
|
-
|
81
|
+
begin
|
82
|
+
sqs_msg.visibility_timeout = queue_visibility
|
83
|
+
yield sqs_msg, body if block_given?
|
84
|
+
rescue StandardError => e
|
85
|
+
error "Processor #{queue} failed to extend visibility of message: #{e.message}\n#{e.backtrace.join("\n")}"
|
86
|
+
end
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
data/lib/toiler/cli.rb
CHANGED
@@ -53,7 +53,7 @@ module Toiler
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def trap_signals
|
56
|
-
%w(INT TERM USR1 USR2 TTIN).each do |sig|
|
56
|
+
%w(INT TERM QUIT USR1 USR2 TTIN).each do |sig|
|
57
57
|
begin
|
58
58
|
trap sig do
|
59
59
|
@self_write.puts(sig)
|
@@ -64,8 +64,19 @@ module Toiler
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
def print_stacktraces
|
68
|
+
return unless Toiler.logger
|
69
|
+
Toiler.logger.info "-------------------\nReceived QUIT, dumping threads:"
|
70
|
+
Thread.list.each do |t|
|
71
|
+
Toiler.logger "[thread:#{t.object_id}] #{t.backtrace.join("\n[thread:#{t.object_id}] ")}"
|
72
|
+
end
|
73
|
+
Toiler.logger '-------------------'
|
74
|
+
end
|
75
|
+
|
67
76
|
def handle_signal(signal)
|
68
77
|
case signal
|
78
|
+
when 'QUIT'
|
79
|
+
print_stacktraces
|
69
80
|
when 'INT', 'TERM'
|
70
81
|
fail Interrupt
|
71
82
|
end
|
data/lib/toiler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Schepens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|