message-driver 0.2.0 → 0.2.1

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: 6e9f0a7a7dd768f5bf8af2020720c7bf6a5f550d
4
- data.tar.gz: daafbfc5b67b2eb79c562e490dbc4516ac8bb8e0
3
+ metadata.gz: 2f5ef960a3a18031fa4f37ed941eae929da2237d
4
+ data.tar.gz: 699dee982c1d805fde348b8af5354df212cabc03
5
5
  SHA512:
6
- metadata.gz: e788da60c674485779dc4a910cc6e88a8a7e8bcbbe2d53c63b63b150d56ea4a91eea7c673dbe4e80fa6dd3532a773d054b05fceacc6c8ae46b3c6737f1b09ec8
7
- data.tar.gz: 5694fa3975c55b9e610e8028f2e61402e6925402210188d78c5a02e41120365fc42de2567a7c89e21f88134ab6609f7174ac96cc23ecbb06ed3bc8c9191c30e0
6
+ metadata.gz: 362dffea89638f6366ecf26e673c510aa40981e77f590470e377d51b87e07271caa151bcc8d04b948e1dbe7d1a9268b7cba57fa646328645e8ab58b318ea31cc
7
+ data.tar.gz: b044a83acfc3be5a1a6760eb1543cca63f6cf4b08f07a9a3a0e697bdd152e1aa546580a628351986fcbc2156c6c1d2724d101632c18366cecefd6b85750e80e1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0.dev - master
4
+
5
+ ## 0.2.1 - 2013-11-13
6
+
7
+ * Correct an issue in handling Bunny::ConnectionLevelErrors.
8
+ Bunny::Session will now get properly restarted.
9
+
3
10
  ## 0.2.0 - 2013-11-05
4
11
 
5
12
  * drop support for bunny 0.9.x
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0.dev - master
4
+
5
+ ## 0.2.1 - 2013-11-13
6
+
7
+ * Correct an issue in handling Bunny::ConnectionLevelErrors.
8
+ Bunny::Session will now get properly restarted.
9
+
3
10
  ## 0.2.0 - 2013-11-05
4
11
 
5
12
  * drop support for bunny 0.9.x
@@ -183,10 +183,11 @@ module MessageDriver
183
183
  def initialize(config)
184
184
  validate_bunny_version
185
185
  @config = config
186
+ start_connection_thread
186
187
  end
187
188
 
188
189
  def connection(ensure_started=true)
189
- @connection ||= Bunny.new(@config)
190
+ start_connection_thread
190
191
  if ensure_started && !@connection.open?
191
192
  begin
192
193
  @connection.start
@@ -398,6 +399,29 @@ module MessageDriver
398
399
 
399
400
  private
400
401
 
402
+ def start_connection_thread
403
+ @connection_thread ||= Thread.new do
404
+ begin
405
+ @connection = Bunny.new(@config)
406
+ sleep
407
+ rescue *NETWORK_ERRORS => e
408
+ logger.error "error on connection\n#{exception_to_str(e)}"
409
+ begin
410
+ while true
411
+ @connection.start
412
+ sleep
413
+ end
414
+ rescue *NETWORK_ERRORS => e
415
+ logger.error "error trying to restart connection\n#{exception_to_str(e)}"
416
+ sleep 1
417
+ retry
418
+ end
419
+ end
420
+ @connection_thread = nil
421
+ end
422
+ sleep 0.1 while @connection_thread.status != 'sleep'
423
+ end
424
+
401
425
  def validate_bunny_version
402
426
  required = Gem::Requirement.create('>= 0.10.8')
403
427
  current = Gem::Version.create(Bunny::VERSION)
@@ -1,5 +1,5 @@
1
1
  module Message
2
2
  module Driver
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Campbell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-05 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake