coney_island 0.6 → 0.7

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: 9b268c2c6635a2b24dca5298f43937dd2d9d410f
4
- data.tar.gz: f1625c8b2a24268d9161c4a569c38c4f890dc264
3
+ metadata.gz: 7c6e16e85747e1d7eb7ca008b0b193d0b7bb5968
4
+ data.tar.gz: 26c71402914d4a3947270aed653da903955ce0b2
5
5
  SHA512:
6
- metadata.gz: e8578848be730f24c738d135dea8215eee0405f203444c21321f2717f05076d9789ff19238b55b7e870e1fa71a6ae12fa8b232ff57a1b398ed644d2043781e9d
7
- data.tar.gz: 4a018053eae956c62b0d6518594505ae04a01477521571f3f0542ef4d59422e9567ff666b16b92c1b5d0a34f91f5790f7bb8e3f4fdfe9b2382aef2db23ea2019
6
+ metadata.gz: 8798aa23ab52a69563f618cbe330279389635a6abe0432b95a599913610cf05a701387fa6142467bf4b5b9f6497f8c3e3bba40b7fbef08f5650a09f5b9cf8502
7
+ data.tar.gz: e76ed3ee358c56c542fc4ce909aed4e0fc0f849bdb6eaccd5044b11d987c619f01f35446014f0b1c02c10243191894c174985a35dc917ca860475f4bd85bb94f
@@ -2,7 +2,9 @@ require 'coney_island/coney_island_adapter'
2
2
  module ConeyIsland
3
3
  class Railtie < Rails::Railtie
4
4
  initializer "coney_island.coney_island_adapter" do
5
- ActiveJob::QueueAdapters.send :autoload, :ConeyIslandAdapter
5
+ if defined? ActiveJob
6
+ ActiveJob::QueueAdapters.send :autoload, :ConeyIslandAdapter
7
+ end
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module ConeyIsland
2
- VERSION = "0.6"
2
+ VERSION = "0.7"
3
3
  end
@@ -78,19 +78,19 @@ module ConeyIsland
78
78
  defined?(ActiveRecord::Base) and
79
79
  ActiveRecord::Base.establish_connection
80
80
 
81
- begin
82
- EventMachine.run do
81
+ EventMachine.run do
83
82
 
84
- Signal.trap('INT') do
85
- self.shutdown('INT')
86
- end
87
- Signal.trap('TERM') do
88
- self.shutdown('TERM')
89
- end
83
+ Signal.trap('INT') do
84
+ self.shutdown('INT')
85
+ end
86
+ Signal.trap('TERM') do
87
+ self.shutdown('TERM')
88
+ end
90
89
 
90
+ begin
91
91
  AMQP.connect(self.amqp_parameters) do |connection|
92
92
  self.log.info("Connected to AMQP broker. Running #{AMQP::VERSION}")
93
- @channel ||= AMQP::Channel.new(connection)
93
+ @channel = AMQP::Channel.new(connection)
94
94
  @exchange = @channel.topic('coney_island')
95
95
 
96
96
  #send a heartbeat every 15 seconds to avoid aggresive network configurations that close quiet connections
@@ -106,22 +106,22 @@ module ConeyIsland
106
106
  self.handle_incoming_message(metadata,payload)
107
107
  end
108
108
  end
109
- end
110
- rescue AMQP::TCPConnectionFailed => e
111
- ConeyIsland.tcp_connection_retries ||= 0
112
- ConeyIsland.tcp_connection_retries += 1
113
- if ConeyIsland.tcp_connection_retries >= ConeyIsland.tcp_connection_retry_limit
114
- message = "Failed to connect to RabbitMQ #{ConeyIsland.tcp_connection_retry_limit} times, bailing out"
115
- self.log.error(message)
116
- ConeyIsland.poke_the_badger(e, {
117
- code_source: 'ConeyIsland::Worker.start',
118
- reason: message}
119
- )
120
- else
121
- message = "Failed to connecto to RabbitMQ Attempt ##{ConeyIsland.tcp_connection_retries} time(s), trying again in #{ConeyIsland.tcp_connection_retry_interval} seconds..."
122
- self.log.error(message)
123
- sleep(10)
124
- retry
109
+ rescue AMQP::TCPConnectionFailed => e
110
+ ConeyIsland.tcp_connection_retries ||= 0
111
+ ConeyIsland.tcp_connection_retries += 1
112
+ if ConeyIsland.tcp_connection_retries >= ConeyIsland.tcp_connection_retry_limit
113
+ message = "Failed to connect to RabbitMQ #{ConeyIsland.tcp_connection_retry_limit} times, bailing out"
114
+ self.log.error(message)
115
+ ConeyIsland.poke_the_badger(e, {
116
+ code_source: 'ConeyIsland::Worker.start',
117
+ reason: message}
118
+ )
119
+ else
120
+ message = "Failed to connecto to RabbitMQ Attempt ##{ConeyIsland.tcp_connection_retries} time(s), trying again in #{ConeyIsland.tcp_connection_retry_interval} seconds..."
121
+ self.log.error(message)
122
+ sleep(10)
123
+ retry
124
+ end
125
125
  end
126
126
  end
127
127
  end
@@ -141,7 +141,7 @@ module ConeyIsland
141
141
  end
142
142
  rescue Timeout::Error => e
143
143
  ConeyIsland.poke_the_badger(e, {code_source: 'ConeyIsland', job_payload: args, reason: 'timeout in subscribe code before calling job method'})
144
- rescue Exception => e
144
+ rescue StandardError => e
145
145
  ConeyIsland.poke_the_badger(e, {code_source: 'ConeyIsland', job_payload: args})
146
146
  self.log.error("ConeyIsland code error, not application code:\n#{e.inspect}\nARGS: #{args}")
147
147
  end
@@ -166,7 +166,7 @@ module ConeyIsland
166
166
  self.handle_job(metadata,args,job_id)
167
167
  end
168
168
  end
169
- rescue Exception => e
169
+ rescue StandardError => e
170
170
  ConeyIsland.poke_the_badger(e, {work_queue: @ticket, job_payload: args})
171
171
  self.log.error("Error executing #{args['klass']}##{args['method_name']} #{job_id} for id #{args['instance_id']} with args #{args}:")
172
172
  self.log.error(e.message)
@@ -1,2 +1,4 @@
1
1
  ConeyIsland::Submitter.submit! about to iterate over this many jobs: 1
2
2
  Failed to connecto to RabbitMQ Attempt #1 time(s), trying again in 0 seconds...
3
+ ConeyIsland::Submitter.submit! about to iterate over this many jobs: 1
4
+ Failed to connecto to RabbitMQ Attempt #1 time(s), trying again in 0 seconds...
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coney_island
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-22 00:00:00.000000000 Z
12
+ date: 2015-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails