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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b15b0f5502947a211eac261f595a91abae778941
4
- data.tar.gz: ee098f6e8ce36b909cfd0c521b7208f73ca89798
3
+ metadata.gz: ac31055456f72df45ea622260b0ca64f4827e4f4
4
+ data.tar.gz: 10121bb12dabdfad2bcd635c0f18ff8de26f305b
5
5
  SHA512:
6
- metadata.gz: d9000646169a24af31b427389e24d03f8bdaee492bf3ccc3f9dd12e975335711d1e0c468d99c78c0f83ac119bad5f3848fb24f36ef1268cfabbb7768d96c6414
7
- data.tar.gz: ec817e13da4fc3cdf8e56f1ef252f45c794882c7e69c1fb9eef19b6f24ffe394084b793b13c553c5bdcf3086ab6de7ba8856b1080dc92702c9b11f8095923e0d
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
- if @daemon.running?
44
- logger.fatal { "The agency is alredy running" }
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
- Smith.compile_acls
48
+ @daemon.daemonise
52
49
 
53
- Smith.start do
54
- # This block is here so the that the shutdown hook added in
55
- # Smith.start runs last. Yes I know this is leaky but that's how
56
- # it is at the moment.
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
- Smith.shutdown_hook do
59
- @daemon.unlink_pid_file
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
- agency_runner = Smith::AgencyRunner.new(opts)
95
- agency_runner.run
91
+ begin
92
+ agency_runner = Smith::AgencyRunner.new(opts)
93
+ agency_runner.run
94
+ rescue Smith::AgencyRunning => e
95
+ puts e.message
96
+ end
@@ -6,6 +6,8 @@ module Smith
6
6
  end
7
7
  end
8
8
 
9
+ class AgencyRunning < RuntimeError; end
10
+
9
11
  module Messaging
10
12
  class MessageTimeoutError < RuntimeError; end
11
13
  end
@@ -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 { "Requeue limit reached: #{total_count} for queue: #{@queue.name}, cummulative delay: #{cumulative_delay}s." }
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}. [options]: #{opts}" }
39
- logger.verbose { "Requeuing to: #{@queue.name}. [message]: #{@message}" }
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(ACL::Factory.create(@metadata.type, @message), opts)
41
+ @exchange.publish(@message, opts)
42
42
  end
43
43
  end
44
44
 
data/lib/smith/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Smith
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
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
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-20 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amqp