em-synchrony 1.0.5 → 1.0.6

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: da875d80b703df6b9a5edcb8af8a005347e53a4a
4
- data.tar.gz: 978abcb2c127704ef62362e97aac92fe71804f1c
3
+ metadata.gz: 28e9e5eb599e7f7d72c090f0626fffb94a641c67
4
+ data.tar.gz: 379c553f5e1ac9d2f0086c1e47f5cb7980c1b6e7
5
5
  SHA512:
6
- metadata.gz: b5b91b1d7b354a8ada8805d96eb16ff9ca5e66d1d0c76d259b27d0f1fc051fecb02c22856e7a5fbfa58fe04223923d2380db5ea543ebe253d4f59d1460fa9789
7
- data.tar.gz: 62c7e7ffa573dd30654b92f0642a61905e2b071d8e5f312eaf0b52321754fcacfd9b59ef669b5fecfb56b16f43165c12b81d684c0d2b32a13c0d05242f42ccfd
6
+ metadata.gz: bd97677133f1c266ffbdbd25a3cfedb8f263fc7e3715ac1bc0c88b8d963c2ae224e71c4a53d4436ae2ea49447bcc0499a92a662e29080f1093a00a637745f3ed
7
+ data.tar.gz: d80f260c6f3261eb3cc0ff6db2eacc0ee9613a7e5f35ab248f1dc12a346ba722a24ef5717a0bcca02138dca401ca84d0fa3283274ec9466f8ad0d464b400e54f
@@ -23,6 +23,9 @@ matrix:
23
23
  script: "bundle exec rspec spec/activerecord_spec.rb"
24
24
  - env: "activerecord=4.2.0"
25
25
  script: "bundle exec rspec spec/activerecord_spec.rb"
26
+ - rvm: 2.3.1
27
+ env: "activerecord=5.0.0"
28
+ script: "bundle exec rspec spec/activerecord_spec.rb"
26
29
  allow_failures:
27
30
  - env: "activerecord=3.2.21"
28
31
  - env: "activerecord=4.2.0"
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "em-synchrony"
6
- s.version = "1.0.5"
6
+ s.version = "1.0.6"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Ilya Grigorik"]
9
9
  s.email = ["ilya@igvita.com"]
@@ -41,7 +41,7 @@ module ActiveRecord
41
41
  include EM::Synchrony::ActiveRecord::Client
42
42
  end
43
43
 
44
- if ::ActiveRecord.version >= Gem::Version.new('4.2')
44
+ if Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new('4.2')
45
45
  require 'em-synchrony/activerecord_4_2'
46
46
  include EM::Synchrony::ActiveRecord::Adapter_4_2
47
47
  else
@@ -7,9 +7,17 @@ require 'em-synchrony/thread'
7
7
  module ActiveRecord
8
8
  module ConnectionAdapters
9
9
  class ConnectionPool
10
- def connection
11
- _fibered_mutex.synchronize do
12
- @reserved_connections[current_connection_id] ||= checkout
10
+ if Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0')
11
+ def connection
12
+ _fibered_mutex.synchronize do
13
+ @thread_cached_conns[connection_cache_key(Thread.current)] ||= checkout
14
+ end
15
+ end
16
+ else
17
+ def connection
18
+ _fibered_mutex.synchronize do
19
+ @reserved_connections[current_connection_id] ||= checkout
20
+ end
13
21
  end
14
22
  end
15
23
 
@@ -10,18 +10,18 @@ module Kernel
10
10
  end
11
11
 
12
12
  # Monkey-patch
13
- def sleep(sleep_time)
13
+ def sleep(*args)
14
14
  if Kernel.em_synchrony_sleep_hook &&
15
15
  EM.reactor_thread? &&
16
16
  !Thread.current[:em_synchrony_sleep_hook_called]
17
17
  begin
18
18
  Thread.current[:em_synchrony_sleep_hook_called] = true
19
- Kernel.em_synchrony_sleep_hook.call(sleep_time)
19
+ Kernel.em_synchrony_sleep_hook.call(args[0])
20
20
  ensure
21
21
  Thread.current[:em_synchrony_sleep_hook_called] = false
22
22
  end
23
23
  else
24
- orig_sleep(sleep_time)
24
+ orig_sleep(*args)
25
25
  end
26
26
  end
27
27
  end
@@ -1,6 +1,7 @@
1
1
  require "spec/helper/all"
2
2
  require "em-synchrony/activerecord"
3
3
  require "em-synchrony/fiber_iterator"
4
+ require "logger"
4
5
 
5
6
  # mysql < spec/widgets.sql
6
7
 
@@ -14,6 +14,18 @@ describe EventMachine::Synchrony do
14
14
  EM::Synchrony.on_sleep { fail 'should not happen' }
15
15
  expect { sleep(0.01) }.not_to raise_error
16
16
  end
17
+
18
+ it 'works when calling with no arguments' do
19
+ t = Thread.new do
20
+ expect { sleep }.to_not raise_error
21
+ end
22
+ while t.status
23
+ if t.status == 'sleep'
24
+ t.run
25
+ end
26
+ end
27
+ t.join
28
+ end
17
29
  context 'with synchrony in another thread'do
18
30
  before do
19
31
  @thread = Thread.new do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-synchrony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Grigorik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-10 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.4.5.1
124
+ rubygems_version: 2.5.1
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Fiber aware EventMachine libraries
@@ -155,4 +155,3 @@ test_files:
155
155
  - spec/thread_spec.rb
156
156
  - spec/timer_spec.rb
157
157
  - spec/widgets.sql
158
- has_rdoc: