with_connection 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -114,6 +114,21 @@ module ActiveRecord
114
114
  end
115
115
  end
116
116
 
117
+ def valid_busy_fiber?
118
+ ActiveRecord::ConnectionAdapters.fiber_pools.any? do |pool|
119
+ pool.busy_fibers[current_connection_id]
120
+ end
121
+ end
122
+
123
+ def connection_with_sanity_check
124
+ raise "not a busy fiber" if EM.reactor_running? && ! valid_busy_fiber?
125
+ connection_without_sanity_check
126
+ end
127
+
128
+ unless Rails.env == 'production'
129
+ alias_method_chain :connection, :sanity_check
130
+ end
131
+
117
132
  private
118
133
 
119
134
  def current_connection_id #:nodoc:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "with_connection"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Doug Youch"]
12
- s.date = "2013-06-04"
12
+ s.date = "2013-06-05"
13
13
  s.description = "Uses active record connection pool logic with the fiber_patch"
14
14
  s.email = "doug@sessionm.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: with_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-04 00:00:00.000000000 Z
12
+ date: 2013-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: 3982890719728245561
113
+ hash: 271538820517515864
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements: