slowpoke 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -2
- data/lib/slowpoke.rb +5 -2
- data/lib/slowpoke/migration.rb +5 -10
- data/lib/slowpoke/railtie.rb +6 -5
- data/lib/slowpoke/version.rb +1 -1
- data/slowpoke.gemspec +2 -3
- metadata +9 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91db9bc17aea48ff4c981c379dd667128f2c1902
|
4
|
+
data.tar.gz: ba3a009f49d2ff5c24c855d8351ee42efb2c1a14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e1c852583fa00010cfe4cafbe0c0e4f17ef88318fc1e069fb4e14a5c9dc0e688f393502bc1e7c667784e2daa5dfd92d18232ffca85a857a0ced4a888fb8482
|
7
|
+
data.tar.gz: ebfe28a37bad757c0da1a762dd94e12db58f885301e695c5686684913230ed692a9e885d37a0d3155781a921631294d6b60e8aaf0723d9f5a3b9ebc7cd980f23
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/slowpoke.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "slowpoke/version"
|
2
2
|
require "rack/timeout/base"
|
3
|
-
require "safely_block"
|
4
3
|
require "slowpoke/middleware"
|
5
4
|
require "slowpoke/migration"
|
6
5
|
require "slowpoke/railtie"
|
@@ -16,7 +15,11 @@ module Slowpoke
|
|
16
15
|
|
17
16
|
def self.timeout=(timeout)
|
18
17
|
timeout = timeout.to_i if timeout.respond_to?(:to_i)
|
19
|
-
@timeout = Rack::Timeout.
|
18
|
+
@timeout = Rack::Timeout.service_timeout = timeout
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.migration_statement_timeout
|
22
|
+
ENV["MIGRATION_STATEMENT_TIMEOUT"]
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
data/lib/slowpoke/migration.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
module Slowpoke
|
2
2
|
module Migration
|
3
3
|
def connection
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
config["variables"]["statement_timeout"] = ENV["MIGRATION_STATEMENT_TIMEOUT"].to_i
|
9
|
-
ActiveRecord::Base.establish_connection(config)
|
10
|
-
ActiveRecord::Base.connection
|
11
|
-
end
|
12
|
-
else
|
13
|
-
super
|
4
|
+
connection = super
|
5
|
+
if Slowpoke.migration_statement_timeout && !@migration_statement_timeout_set
|
6
|
+
connection.execute("SET statement_timeout = #{Slowpoke.migration_statement_timeout.to_i}")
|
7
|
+
@migration_statement_timeout_set = true
|
14
8
|
end
|
9
|
+
connection
|
15
10
|
end
|
16
11
|
end
|
17
12
|
end
|
data/lib/slowpoke/railtie.rb
CHANGED
@@ -2,11 +2,12 @@ module Slowpoke
|
|
2
2
|
class Railtie < Rails::Railtie
|
3
3
|
initializer "slowpoke" do |app|
|
4
4
|
Rack::Timeout.timeout = Slowpoke.timeout
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
if Rails::VERSION::MAJOR >= 5
|
6
|
+
app.config.middleware.insert_after ActionDispatch::DebugExceptions, Rack::Timeout
|
7
|
+
else
|
8
|
+
app.config.middleware.insert_before ActionDispatch::RemoteIp, Rack::Timeout
|
9
|
+
end
|
10
|
+
app.config.middleware.insert(0, Slowpoke::Middleware) unless Rails.env.development?
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/slowpoke/version.rb
CHANGED
data/slowpoke.gemspec
CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency "rails"
|
22
22
|
spec.add_dependency "rack-timeout", ">= 0.3.0"
|
23
|
-
spec.add_dependency "safely_block"
|
24
23
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
27
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slowpoke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,47 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.7'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.7'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '0'
|
83
69
|
description: Rack::Timeout is great. Slowpoke makes it better.
|
84
70
|
email:
|
85
71
|
- andrew@chartkick.com
|
@@ -121,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
107
|
version: '0'
|
122
108
|
requirements: []
|
123
109
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.6.
|
110
|
+
rubygems_version: 2.6.13
|
125
111
|
signing_key:
|
126
112
|
specification_version: 4
|
127
113
|
summary: Rack::Timeout is great. Slowpoke makes it better.
|
128
114
|
test_files: []
|
129
|
-
has_rdoc:
|