anycable-rails 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/anycable-rails.gemspec +1 -1
- data/lib/anycable/rails.rb +3 -2
- data/lib/anycable/rails/activerecord/release_connection.rb +28 -0
- data/lib/anycable/rails/engine.rb +13 -0
- data/lib/anycable/rails/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a89d94c7260dea8c03adc53bff3ddaf249f8404
|
4
|
+
data.tar.gz: b24d94d0dcb9d560d43d08fa3c62165918f83d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af6283c8f2ad3cff91d286ac9445ebfb3236a3e5926fc2794ec19cb65c9132c36131a46f648cce7c2fb0a009d800e703698d3b81502d95793fee70e926125b6d
|
7
|
+
data.tar.gz: 95ba22c633aa3337c93d0dd53eb8badf7bfc028a0093b812b114df88d516f9121162dfe3763977b12561c0e9b738a54e0d45c59e285c534a45d7ee4baf4ea866
|
data/CHANGELOG.md
CHANGED
data/anycable-rails.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "rails", "~> 5"
|
21
|
-
spec.add_dependency "anycable", "~>0.4.
|
21
|
+
spec.add_dependency "anycable", "~>0.4.4"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/anycable/rails.rb
CHANGED
@@ -3,11 +3,12 @@ lib = File.expand_path("../../../../anycable/lib", __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "anycable"
|
5
5
|
require "anycable/rails/version"
|
6
|
-
require "anycable/rails/actioncable/server"
|
7
|
-
require "anycable/rails/actioncable/connection"
|
8
6
|
|
9
7
|
module Anycable
|
10
8
|
# Rails handler for AnyCable
|
11
9
|
module Rails
|
10
|
+
require "anycable/rails/engine"
|
11
|
+
require "anycable/rails/actioncable/server"
|
12
|
+
require "anycable/rails/actioncable/connection"
|
12
13
|
end
|
13
14
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Anycable
|
3
|
+
module Rails
|
4
|
+
module ActiveRecord
|
5
|
+
# Release ActiveRecord connection after every call (if any)
|
6
|
+
module ReleaseConnection
|
7
|
+
def connect(*)
|
8
|
+
wrap_release_connection { super }
|
9
|
+
end
|
10
|
+
|
11
|
+
def disconnect(*)
|
12
|
+
wrap_release_connection { super }
|
13
|
+
end
|
14
|
+
|
15
|
+
def command(*)
|
16
|
+
wrap_release_connection { super }
|
17
|
+
end
|
18
|
+
|
19
|
+
def wrap_release_connection
|
20
|
+
res = yield
|
21
|
+
::ActiveRecord::Base.connection_pool.release_connection if
|
22
|
+
::ActiveRecord::Base.connection_pool.active_connection?
|
23
|
+
res
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Anycable
|
3
|
+
module Rails
|
4
|
+
class Engine < ::Rails::Engine # :nodoc:
|
5
|
+
initializer "release AR connections in RPC handler" do |_app|
|
6
|
+
ActiveSupport.on_load(:active_record) do
|
7
|
+
require "anycable/rails/activerecord/release_connection"
|
8
|
+
Anycable::RPCHandler.prepend Anycable::Rails::ActiveRecord::ReleaseConnection
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.
|
33
|
+
version: 0.4.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.4.
|
40
|
+
version: 0.4.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +135,8 @@ files:
|
|
135
135
|
- lib/anycable/rails/actioncable/channel.rb
|
136
136
|
- lib/anycable/rails/actioncable/connection.rb
|
137
137
|
- lib/anycable/rails/actioncable/server.rb
|
138
|
+
- lib/anycable/rails/activerecord/release_connection.rb
|
139
|
+
- lib/anycable/rails/engine.rb
|
138
140
|
- lib/anycable/rails/refinements/subscriptions.rb
|
139
141
|
- lib/anycable/rails/version.rb
|
140
142
|
- lib/generators/anycable/USAGE
|