emissary 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 3
4
- :patch: 8
4
+ :patch: 9
@@ -17,6 +17,7 @@ require 'rubygems'
17
17
  require 'uuid'
18
18
  require 'digest/md5'
19
19
  require 'yaml'
20
+ require 'pathname'
20
21
 
21
22
  begin
22
23
  require 'thread'
@@ -26,14 +27,14 @@ end
26
27
 
27
28
  module Emissary
28
29
  # :stopdoc:
29
- LIBPATH = File.expand_path(File.dirname(File.expand_path(__FILE__))) + File::SEPARATOR
30
- PATH = File.dirname(LIBPATH) + File::SEPARATOR
31
- VERSION = ::YAML.load(File.read(File.join(PATH, 'VERSION.yml'))).values.join '.'
30
+ LIBPATH = Pathname.new(__FILE__).dirname.realpath
31
+ PATH = LIBPATH.dirname
32
+ VERSION = ::YAML.load(PATH + 'VERSION.yml')).values.join '.'
32
33
 
33
- EXTERNALS_BASE = File.join(File::SEPARATOR, 'opt')
34
- EXTERNAL_IDENTITIES = File.join(EXTERNALS_BASE, 'emissary', 'identities')
35
- EXTERNAL_AGENTS = File.join(EXTERNALS_BASE, 'emissary', 'agents')
36
- EXTERNAL_OPERATORS = File.join(EXTERNALS_BASE, 'emissary', 'operators')
34
+ EXTERNALS_BASE = Pathname.new('/opt/emissary')
35
+ EXTERNAL_IDENTITIES = EXTERNALS_BASE + 'identities'
36
+ EXTERNAL_AGENTS = EXTERNALS_BASE + 'agents'
37
+ EXTERNAL_OPERATORS = EXTERNALS_BASE + 'operators'
37
38
 
38
39
  DEFAULT_EXCHANGE = :direct
39
40
  DAEMON_RECHECK_INTERVAL = 10
@@ -58,7 +59,7 @@ module Emissary
58
59
  # <tt>File.join</tt>.
59
60
  #
60
61
  def libpath( *args )
61
- args.empty? ? LIBPATH : File.join(LIBPATH, args.flatten)
62
+ LIBPATH.join(args.flatten)
62
63
  end
63
64
 
64
65
  # Returns the path for the module. If any arguments are given,
@@ -116,6 +116,16 @@ module Emissary
116
116
 
117
117
 
118
118
  def connection
119
+ begin
120
+ @connection.ping() unless @connection.nil?
121
+ rescue ::Mysql::Error => e
122
+ if e.message =~ /server has gone away/
123
+ @connection = nil
124
+ else
125
+ raise e
126
+ end
127
+ end
128
+
119
129
  @connection ||= ::Mysql.real_connect(@host, @user, @password)
120
130
  end
121
131
 
@@ -165,8 +175,8 @@ module Emissary
165
175
  }
166
176
  end
167
177
  ensure
168
- kill_watcher_thread!
169
178
  disconnect
179
+ kill_watcher_thread!
170
180
  end
171
181
  end
172
182
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emissary
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 8
10
- version: 1.3.8
9
+ - 9
10
+ version: 1.3.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carl P. Corliss
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-18 00:00:00 -04:00
18
+ date: 2011-06-15 00:00:00 -04:00
19
19
  default_executable: bin/emissary-setup
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -228,7 +228,7 @@ files:
228
228
  - VERSION.yml
229
229
  - LICENSE
230
230
  - README.txt
231
- has_rdoc: true
231
+ has_rdoc: false
232
232
  homepage: http://www.nytimes.com/
233
233
  licenses: []
234
234