switchman 1.3.9 → 1.3.10
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e276855b3c8456e699ac6b6c98acb63f7073651
|
4
|
+
data.tar.gz: 5bde98e540b07948028776ae6565e112847b6086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83f34a2731eab5383632da988c0f0b72ee0b13c56db38d3ae94b3e93af3117ffc6b95a9886c11f5878b726520f19a7c2f1e074d0e4dd436b4a7e253866e8886
|
7
|
+
data.tar.gz: cb6cb6bb2ac31c99777c892e3af926be2c1c8480da0a9ccbb6e1b3fd05bc000deb7b7bdcef8b04b8a1bd641f89c8c690de3c932daadaaaab0c5e3e9b528c796c
|
@@ -39,21 +39,26 @@ module Switchman
|
|
39
39
|
def release_connection_with_idle_timeout(with_id = current_connection_id)
|
40
40
|
release_connection_without_idle_timeout(with_id)
|
41
41
|
|
42
|
-
# TODO may need a synchronize (or to be included in a synchronize
|
43
|
-
# inside release_connection_without_idle_timeout) when we make
|
44
|
-
# switchman thread-safe
|
45
42
|
if spec.config[:idle_timeout]
|
46
43
|
clear_idle_connections!(Time.now - spec.config[:idle_timeout].to_i)
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
50
47
|
def clear_idle_connections!(since_when)
|
51
|
-
|
52
|
-
|
53
|
-
conn.
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
synchronize do
|
49
|
+
@connections.reject! do |conn|
|
50
|
+
if conn.last_query_at < since_when && !conn.in_use?
|
51
|
+
conn.disconnect!
|
52
|
+
true
|
53
|
+
else
|
54
|
+
false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if ::Rails.version >= '4'
|
58
|
+
@available.clear
|
59
|
+
@connections.each do |conn|
|
60
|
+
@available.add conn
|
61
|
+
end
|
57
62
|
end
|
58
63
|
end
|
59
64
|
end
|
data/lib/switchman/version.rb
CHANGED
data/spec/dummy/log/test.log
CHANGED
@@ -356813,3 +356813,27 @@ Connecting to database specified by database.yml
|
|
356813
356813
|
[1m[35m (0.1ms)[0m ROLLBACK
|
356814
356814
|
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
356815
356815
|
[1m[35m (0.1ms)[0m ROLLBACK
|
356816
|
+
[1m[36m (2.7ms)[0m [1mSELECT * FROM unnest(current_schemas(false))[0m
|
356817
|
+
[1m[35mSwitchman::Shard Load (25.9ms)[0m SELECT "switchman_shards".* FROM "switchman_shards" WHERE "switchman_shards"."default" = 't' ORDER BY "switchman_shards"."id" ASC LIMIT 1
|
356818
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
356819
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
356820
|
+
[1m[36mSQL (1.9ms)[0m [1mINSERT INTO "switchman_shards" ("database_server_id") VALUES ($1) RETURNING "id"[0m [["database_server_id", "1"]]
|
356821
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
356822
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
356823
|
+
[1m[36m (1.3ms)[0m [1mSELECT * FROM unnest(current_schemas(false))[0m
|
356824
|
+
[1m[35mSwitchman::Shard Load (0.6ms)[0m SELECT "switchman_shards".* FROM "switchman_shards" WHERE "switchman_shards"."default" = 't' ORDER BY "switchman_shards"."id" ASC LIMIT 1
|
356825
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
356826
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
356827
|
+
[1m[36mSQL (0.8ms)[0m [1mINSERT INTO "switchman_shards" ("database_server_id") VALUES ($1) RETURNING "id"[0m [["database_server_id", "1"]]
|
356828
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
356829
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
356830
|
+
[1m[36m (0.4ms)[0m [1mSELECT * FROM unnest(current_schemas(false))[0m
|
356831
|
+
[1m[35mSwitchman::Shard Load (0.6ms)[0m SELECT "switchman_shards".* FROM "switchman_shards" WHERE "switchman_shards"."default" = 't' ORDER BY "switchman_shards"."id" ASC LIMIT 1
|
356832
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
356833
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
356834
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "switchman_shards" ("database_server_id") VALUES ($1) RETURNING "id"[0m [["database_server_id", "1"]]
|
356835
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
356836
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
356837
|
+
Connecting to database specified by database.yml
|
356838
|
+
[1m[36m (0.4ms)[0m [1mSELECT * FROM unnest(current_schemas(false))[0m
|
356839
|
+
[1m[35mSwitchman::Shard Load (0.5ms)[0m SELECT "switchman_shards".* FROM "switchman_shards" WHERE "switchman_shards"."default" = 't' LIMIT 1
|
@@ -37,6 +37,8 @@ module Switchman
|
|
37
37
|
@pool.checkin(@conn)
|
38
38
|
@pool.clear_idle_connections!(@conn.last_query_at + 1)
|
39
39
|
expect(@pool.connections).to be_empty
|
40
|
+
# fresh connection
|
41
|
+
expect(@pool.connection).to_not eq @conn
|
40
42
|
end
|
41
43
|
|
42
44
|
it "should not affect idle but checked out connections" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|