slowpoke 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +0 -1
- data/lib/generators/slowpoke/install_generator.rb +0 -1
- data/lib/slowpoke.rb +1 -2
- data/lib/slowpoke/controller.rb +1 -2
- data/lib/slowpoke/postgres.rb +1 -2
- data/lib/slowpoke/railtie.rb +0 -2
- data/lib/slowpoke/version.rb +1 -1
- data/slowpoke.gemspec +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 386bc598cac17cf2094f6260750e204fae2f1eb3
|
4
|
+
data.tar.gz: dbc8b84fbeb145cfc78ef211d033b7706a704287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f0ec80ef1ee5c638ca7cddc25fd0592da42920dbcb5c5daaefb6b0cfb8de9afae611f69795e76a394a13c994f58b7ea171fc6dd5e9f1398296885be9ae0655
|
7
|
+
data.tar.gz: fcc475c88fcb9374ba26c1c7bd14bf132a378698300661d50709f0f3a2ace41a2ab94292f3098b8f31a6e4ad2fcc4500f6139c7e46451418d12bb03b03c52e03
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/slowpoke.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "slowpoke/version"
|
2
2
|
require "rack-timeout"
|
3
|
-
require "
|
3
|
+
require "safely_block"
|
4
4
|
require "slowpoke/controller"
|
5
5
|
require "slowpoke/postgres"
|
6
6
|
require "slowpoke/railtie"
|
@@ -26,7 +26,6 @@ module Slowpoke
|
|
26
26
|
def self.database_timeout
|
27
27
|
@database_timeout ||= ENV["DATABASE_TIMEOUT"].to_i if ENV["DATABASE_TIMEOUT"]
|
28
28
|
end
|
29
|
-
|
30
29
|
end
|
31
30
|
|
32
31
|
# custom error page
|
data/lib/slowpoke/controller.rb
CHANGED
@@ -11,12 +11,11 @@ module Slowpoke
|
|
11
11
|
def bubble_timeout
|
12
12
|
yield
|
13
13
|
rescue => exception
|
14
|
-
if exception.respond_to?(:original_exception)
|
14
|
+
if exception.respond_to?(:original_exception) && exception.original_exception.is_a?(Rack::Timeout::Error)
|
15
15
|
raise exception.original_exception
|
16
16
|
else
|
17
17
|
raise exception
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
22
21
|
end
|
data/lib/slowpoke/postgres.rb
CHANGED
@@ -10,7 +10,7 @@ module Slowpoke
|
|
10
10
|
configure_connection_without_statement_timeout
|
11
11
|
safely do
|
12
12
|
timeout = Slowpoke.database_timeout || Slowpoke.timeout
|
13
|
-
if timeout
|
13
|
+
if timeout && !timeout.respond_to?(:call)
|
14
14
|
if ActiveRecord::Base.logger
|
15
15
|
ActiveRecord::Base.logger.silence do
|
16
16
|
execute("SET statement_timeout = #{timeout * 1000}")
|
@@ -21,6 +21,5 @@ module Slowpoke
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
24
|
end
|
26
25
|
end
|
data/lib/slowpoke/railtie.rb
CHANGED
data/lib/slowpoke/version.rb
CHANGED
data/slowpoke.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "slowpoke/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "slowpoke"
|
8
8
|
spec.version = Slowpoke::VERSION
|
9
9
|
spec.authors = ["Andrew Kane"]
|
10
10
|
spec.email = ["andrew@chartkick.com"]
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = "Timeouts made easy"
|
12
|
+
spec.description = "Timeouts made easy"
|
13
13
|
spec.homepage = "https://github.com/ankane/slowpoke"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "rack-timeout", ">= 0.1.0"
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "safely_block"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
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.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-timeout
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: safely_block
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|