smith 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/agency +23 -22
- data/lib/smith/exceptions.rb +2 -0
- data/lib/smith/messaging/requeue.rb +4 -4
- data/lib/smith/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: ac31055456f72df45ea622260b0ca64f4827e4f4
|
4
|
+
data.tar.gz: 10121bb12dabdfad2bcd635c0f18ff8de26f305b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc73bc698ffc76b75ba3a92715728216dc53eeb34cfca95693234f86cd693f799f6cebe2fc9ab74926351e88513ee22f4efd5fcac49c4497388f0f87a67b4de
|
7
|
+
data.tar.gz: 6fa9ee4e078d7c9c82879adef1ef4956820e79f160ec12d0cd92e27190a77d0b3f4d0df08e81fbcc462919236f7047b99b0cc168ea9f8effddf06eebf655b3d6
|
data/bin/agency
CHANGED
@@ -19,11 +19,13 @@ module Smith
|
|
19
19
|
AGENCY_NAME = 'agency'
|
20
20
|
|
21
21
|
def initialize(opts={})
|
22
|
-
|
23
22
|
@options = opts
|
24
23
|
options_check
|
25
24
|
|
26
25
|
@daemon = Daemon.new(add_vhost(AGENCY_NAME), opts[:daemon], opts[:pid_dir])
|
26
|
+
|
27
|
+
raise AgencyRunning, "The agency is alredy running." if @daemon.running?
|
28
|
+
|
27
29
|
@agency = Agency.new
|
28
30
|
|
29
31
|
Smith.shutdown_hook do
|
@@ -40,29 +42,24 @@ module Smith
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def run
|
43
|
-
|
44
|
-
|
45
|
-
else
|
46
|
-
logger.info { "Using config file: #{Smith.config_path}" }
|
47
|
-
require 'smith/messaging/acl_type_cache'
|
48
|
-
|
49
|
-
@daemon.daemonise
|
45
|
+
logger.info { "Using config file: #{Smith.config_path}" }
|
46
|
+
require 'smith/messaging/acl_type_cache'
|
50
47
|
|
51
|
-
|
48
|
+
@daemon.daemonise
|
52
49
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
Smith.compile_acls
|
51
|
+
Smith.start do
|
52
|
+
# This block is here so the that the shutdown hook added in
|
53
|
+
# Smith.start runs last. Yes I know this is leaky but that's how
|
54
|
+
# it is at the moment.
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
logger.info { "Starting #{File.basename($0)}" }
|
63
|
-
@agency.setup_queues
|
64
|
-
@agency.start_monitoring
|
56
|
+
Smith.shutdown_hook do
|
57
|
+
@daemon.unlink_pid_file
|
65
58
|
end
|
59
|
+
|
60
|
+
logger.info { "Starting #{File.basename($0)}" }
|
61
|
+
@agency.setup_queues
|
62
|
+
@agency.start_monitoring
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
@@ -91,5 +88,9 @@ opts = Trollop::with_standard_exception_handling parser do
|
|
91
88
|
parser.parse ARGV
|
92
89
|
end
|
93
90
|
|
94
|
-
|
95
|
-
agency_runner.
|
91
|
+
begin
|
92
|
+
agency_runner = Smith::AgencyRunner.new(opts)
|
93
|
+
agency_runner.run
|
94
|
+
rescue Smith::AgencyRunning => e
|
95
|
+
puts e.message
|
96
|
+
end
|
data/lib/smith/exceptions.rb
CHANGED
@@ -20,7 +20,7 @@ module Smith
|
|
20
20
|
}
|
21
21
|
|
22
22
|
@on_requeue_limit = opts[:on_requeue_limit] || ->(message, count, total_count, cumulative_delay) {
|
23
|
-
logger.info { "
|
23
|
+
logger.info { "Not attempting any more requeues, requeue limit reached: #{total_count} for queue: #{@queue.name}, cummulative delay: #{cumulative_delay}s." }
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
@@ -35,10 +35,10 @@ module Smith
|
|
35
35
|
o[:type] = @metadata.type
|
36
36
|
end
|
37
37
|
|
38
|
-
logger.verbose { "Requeuing to: #{@queue.name}
|
39
|
-
logger.verbose { "Requeuing to: #{@queue.name}
|
38
|
+
logger.verbose { "Requeuing to: #{@queue.name} [options]: #{opts}" }
|
39
|
+
logger.verbose { "Requeuing to: #{@queue.name} [message]: #{@message.to_hash}" }
|
40
40
|
|
41
|
-
@exchange.publish(
|
41
|
+
@exchange.publish(@message, opts)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/lib/smith/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Heycock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amqp
|