rack-timeout 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.markdown +0 -1
- data/lib/rack/timeout/rollbar.rb +8 -5
- data/lib/rack/timeout/support/timeout.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9ae29d987db68c611785883420553a2f6f40ee7
|
4
|
+
data.tar.gz: 1c1785b62a64d3a6cf5b5937baae4dec0a092ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22dd8d23074301936134273f9dd3763c1dfb03a42ad49ea0e63f53f0db64095135e00b33fdcc08f9b10fb9a8d43ad94c3dc94bf527e054e6e0376c65a8c6d131
|
7
|
+
data.tar.gz: 114c9f37b4b435d213eb33fa4596cc18b0949f1c670fd2c9c25b3a4a061666ffb7a1bd52540d46b752d1795b224455ab9399b8d496e8e5f62cfb9812c0a8270a
|
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
@@ -213,7 +213,6 @@ You can remove an observer with `unregister_state_change_observer`:
|
|
213
213
|
Rack::Timeout.unregister_state_change_observer(:a_unique_name)
|
214
214
|
```
|
215
215
|
|
216
|
-
|
217
216
|
rack-timeout's logging is implemented using an observer; see `Rack::Timeout::StateChangeLoggingObserver` in logging-observer.rb for the implementation.
|
218
217
|
|
219
218
|
Custom observers might be used to do cleanup, store statistics on request length, timeouts, etc., and potentially do performance tuning on the fly.
|
data/lib/rack/timeout/rollbar.rb
CHANGED
@@ -1,22 +1,25 @@
|
|
1
1
|
require_relative "core"
|
2
2
|
|
3
3
|
# Groups timeout exceptions in rollbar by exception class, http method, and url.
|
4
|
-
#
|
4
|
+
#
|
5
|
+
# Usage: after requiring rollbar (say, in your rollbar initializer file), call:
|
6
|
+
#
|
5
7
|
# require "rack/timeout/rollbar"
|
6
8
|
#
|
7
9
|
# This is somewhat experimental and very lightly tested.
|
8
10
|
#
|
9
|
-
# Ruby 2.0 is required as we use Module.prepend
|
11
|
+
# Ruby 2.0 is required as we use `Module.prepend`.
|
10
12
|
|
11
13
|
module Rack::Timeout::Rollbar
|
12
14
|
def build_payload(level, message, exception, extra)
|
13
15
|
payload = super(level, message, exception, extra)
|
14
16
|
|
15
|
-
return payload unless exception.is_a?
|
16
|
-
|
17
|
+
return payload unless exception.is_a?(::Rack::Timeout::ExceptionWithEnv) \
|
18
|
+
&& payload.respond_to?(:[]) \
|
19
|
+
&& payload.respond_to?(:[]=)
|
17
20
|
|
18
21
|
data = payload["data"]
|
19
|
-
return payload unless data.respond_to?
|
22
|
+
return payload unless data.respond_to?(:[]=)
|
20
23
|
|
21
24
|
request = ::Rack::Request.new(exception.env)
|
22
25
|
payload = payload.dup
|
@@ -18,7 +18,7 @@ class Rack::Timeout::Scheduler::Timeout
|
|
18
18
|
job = @scheduler.run_in(secs) { @on_timeout.call thr } # schedule this thread to be timed out; should get cancelled if block completes on time
|
19
19
|
return block.call # do what you gotta do
|
20
20
|
ensure #
|
21
|
-
job.cancel!
|
21
|
+
job.cancel! if job # cancel the scheduled timeout job; if the block completed on time, this
|
22
22
|
end # will get called before the timeout code's had a chance to run.
|
23
23
|
|
24
24
|
# timeout method on singleton instance for when a custom on_timeout is not required
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-timeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio Chassot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rack middleware which aborts requests that have been running for longer
|
14
14
|
than a specified timeout.
|