rack-timeout 0.3.1 → 0.3.2

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: 3011645170de523349a1928ac09ee55825019f0b
4
- data.tar.gz: 17fcae3abe9f9cf37391a6381a795c142791cde5
3
+ metadata.gz: c9ae29d987db68c611785883420553a2f6f40ee7
4
+ data.tar.gz: 1c1785b62a64d3a6cf5b5937baae4dec0a092ddd
5
5
  SHA512:
6
- metadata.gz: 6eac121daa70934e450db7320a92544840bcc0adba0a38539af380394ac239b546fb428daefa0544a372bff20627f704dfe1ae4415ee99085de1b987b7af35c8
7
- data.tar.gz: 7db38b0f4e1b4d9e2678de2efc867efd2b3381cb615dccf1d365f766576b08107a4d8bc7c2e1fdaf18846a912e88c8ba07862999a86002d7aa1046121b3e886b
6
+ metadata.gz: 22dd8d23074301936134273f9dd3763c1dfb03a42ad49ea0e63f53f0db64095135e00b33fdcc08f9b10fb9a8d43ad94c3dc94bf527e054e6e0376c65a8c6d131
7
+ data.tar.gz: 114c9f37b4b435d213eb33fa4596cc18b0949f1c670fd2c9c25b3a4a061666ffb7a1bd52540d46b752d1795b224455ab9399b8d496e8e5f62cfb9812c0a8270a
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.2
2
+ =====
3
+ - Fixes calling timeout with a value of 0 (issue #90)
4
+
1
5
  0.3.1
2
6
  =====
3
7
  - Rollbar module improvements
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.
@@ -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
- # Usage: after requiring rollbar, call:
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? ::Rack::Timeout::ExceptionWithEnv
16
- return payload unless payload.respond_to? :[]
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! # cancel the scheduled timeout job; if the block completed on time, this
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.1
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-03 00:00:00.000000000 Z
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.