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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04cee7305d4bc3abf484d847fe5bbfea96b50e07
4
- data.tar.gz: d29391739f21509b6d43fae455bc16e7b1f4a466
3
+ metadata.gz: 91db9bc17aea48ff4c981c379dd667128f2c1902
4
+ data.tar.gz: ba3a009f49d2ff5c24c855d8351ee42efb2c1a14
5
5
  SHA512:
6
- metadata.gz: 5ebe972633f91bcbb728083ee16f55e36a2200af9115e81c94c9ab9d6eb7f6c72f75fce62de04f76af18ca1f5a527825bb468999934fc828b36d4d88b03e2437
7
- data.tar.gz: 3cfb727f6695098342f5543da8266472937aaaa3a4b6504d967a6f2e1d9f2bc1204e3c78d2055607bf1c867b01a1502990821e7b3115ff1acf6327d9561e8fad
6
+ metadata.gz: d2e1c852583fa00010cfe4cafbe0c0e4f17ef88318fc1e069fb4e14a5c9dc0e688f393502bc1e7c667784e2daa5dfd92d18232ffca85a857a0ced4a888fb8482
7
+ data.tar.gz: ebfe28a37bad757c0da1a762dd94e12db58f885301e695c5686684913230ed692a9e885d37a0d3155781a921631294d6b60e8aaf0723d9f5a3b9ebc7cd980f23
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.0
2
+
3
+ - Fixed custom error pages for Rails 5.1
4
+ - Fixed migration statement timeout
5
+ - Don’t kill server in development
6
+
1
7
  ## 0.1.3
2
8
 
3
9
  - Fixed deprecation warning in Rails 5
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in slowpoke.gemspec
4
4
  gemspec
5
-
6
- gem "makara", github: "taskrabbit/makara"
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.timeout = 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
 
@@ -1,17 +1,12 @@
1
1
  module Slowpoke
2
2
  module Migration
3
3
  def connection
4
- if ENV["MIGRATION_STATEMENT_TIMEOUT"]
5
- @connection_with_timeout ||= begin
6
- config = ActiveRecord::Base.connection_config
7
- config["variables"] ||= {}
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
@@ -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
- app.config.middleware.insert_before ActionDispatch::RemoteIp, Rack::Timeout
7
-
8
- # prevent RequestExpiryError from killing web server
9
- app.config.middleware.insert 0, Slowpoke::Middleware
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
@@ -1,3 +1,3 @@
1
1
  module Slowpoke
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
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", "~> 1.7"
26
- spec.add_development_dependency "rake", "~> 10.0"
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.1.3
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: 2016-08-04 00:00:00.000000000 Z
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: safely_block
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: :runtime
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: '10.0'
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: '10.0'
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.1
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: