cutoff 0.4.2 → 0.5.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
  SHA256:
3
- metadata.gz: d00ff1f831beec4fed582b5faa9ed42c350c13b32217bdcab0b850445ba9c358
4
- data.tar.gz: 77d466db54a822240d2d27cfdb120f98aa7f7435ec62ae15191292702580de79
3
+ metadata.gz: d13746c455ac05f8491ccd8e5f8834370c0e4d41b77b440a2ee33f7c9bafb9db
4
+ data.tar.gz: 883490b2c6661605d81cf299f809175cadfd1e51b4c68bb218dfa8f996af23cc
5
5
  SHA512:
6
- metadata.gz: 9821d7010a4663ce25497a129c5a04166b5f701bd30d1d7a20f183cd274444605f3ac14099857c22117d45ac980056f4ccbaf09e8b65403e83a93abc923ced90
7
- data.tar.gz: ec1f98a8885f8938ba421d87cb82f7f16a79161a778d2e4c230204f2243009b001e4c5de8c95ca1153746a8eebb90f969ca5efe80390cd08f901ee943a06581f
6
+ metadata.gz: e544dff1eb63defd93d8f1f260c12e843bb3178a1a523d63b327ea76ddea533bcd6ce7c68c2b697d859ad795ad62f8048549ae82997c0d6c9edbee92089de6c0
7
+ data.tar.gz: a1612206aaf0400aa50988b32b35fd7e27418d047e5aab6d7919dfedd30efeaa3675e97f9b6134233f13a54794c01ff7d8868ac892ebf711fc42ef2a65388de5
data/CHANGELOG.md CHANGED
@@ -7,22 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.0] - 2022-08-10
11
+
12
+ ### Changed
13
+
14
+ - Use CLOCK_MONOTONIC instead of CLOCK_MONOTONIC_RAW #10 justinhoward
15
+ - Change CutoffExceededError to inherit from Timeout::Error #9 justinhoward
16
+
17
+ ### Breaking
18
+
19
+ PR #9 changes the parent class of `Cutoff::CutoffExceededError` from `CutoffError`
20
+ to `Timeout::Error`. `CutoffError` changes from a class to a module.
21
+
10
22
  ## [0.4.2] - 2021-10-14
11
23
 
24
+ ### Added
25
+
12
26
  - Add sidekiq middleware
13
27
  - Select checkpoints to enable or disable
14
28
 
15
29
  ## [0.4.1] - 2021-10-02
16
30
 
31
+ ### Fixed
32
+
17
33
  - Fix Net::HTTP patch to override timeouts given to start
18
34
 
19
35
  ## [0.4.0] - 2021-10-01
20
36
 
37
+ ### Added
38
+
21
39
  - Add benchmarks and slight performance improvements
22
40
  - Add Rails controller integration
23
41
 
24
42
  ## [0.3.0] - 2021-08-20
25
43
 
44
+ ### Added
45
+
26
46
  - Allow timers to be disabled globally with `Cutoff.disable!`
27
47
 
28
48
  ## [0.2.0] - 2021-07-22
@@ -38,7 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
58
  - Cutoff class
39
59
  - Mysql2 patch
40
60
 
41
- [Unreleased]: https://github.com/justinhoward/cutoff/compare/v0.4.1...HEAD
61
+ [Unreleased]: https://github.com/justinhoward/cutoff/compare/v0.5.0...HEAD
62
+ [0.5.0]: https://github.com/justinhoward/cutoff/compare/v0.4.2...v0.5.0
42
63
  [0.4.2]: https://github.com/justinhoward/cutoff/compare/v0.4.1...v0.4.2
43
64
  [0.4.1]: https://github.com/justinhoward/cutoff/compare/v0.4.0...v0.4.1
44
65
  [0.4.0]: https://github.com/justinhoward/cutoff/compare/v0.3.0...v0.4.0
data/lib/cutoff/error.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Cutoff
4
4
  # The Cutoff base error class
5
- class CutoffError < StandardError
5
+ module CutoffError
6
6
  private
7
7
 
8
8
  def message_with_meta(message, **meta)
@@ -15,7 +15,9 @@ class Cutoff
15
15
  end
16
16
 
17
17
  # Raised by {Cutoff#checkpoint!} if the time has been exceeded
18
- class CutoffExceededError < CutoffError
18
+ class CutoffExceededError < Timeout::Error
19
+ include CutoffError
20
+
19
21
  attr_reader :cutoff
20
22
 
21
23
  def initialize(cutoff)
data/lib/cutoff/timer.rb CHANGED
@@ -2,18 +2,17 @@
2
2
 
3
3
  class Cutoff
4
4
  module Timer
5
- if defined?(Process::CLOCK_MONOTONIC_RAW)
6
- # The current time
5
+ if defined?(Process::CLOCK_MONOTONIC)
6
+ # The current relative time
7
7
  #
8
8
  # If it is available, this will use a monotonic clock. This is a clock
9
- # that always moves forward in time. If that is not available on this
10
- # system, `Time.now` will be used
9
+ # that always moves forward in time and starts at an arbitrary point
10
+ # (such as system startup time). If that is not available on this system,
11
+ # `Time.now` will be used.
11
12
  #
12
- # @return [Float] The current time as a float
13
- def now
14
- Process.clock_gettime(Process::CLOCK_MONOTONIC_RAW)
15
- end
16
- elsif defined?(Process::CLOCK_MONOTONIC)
13
+ # This does not represent current real time
14
+ #
15
+ # @return [Float] The current relative time as a float
17
16
  def now
18
17
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
18
  end
@@ -3,6 +3,6 @@
3
3
  class Cutoff
4
4
  # @return [Gem::Version] The current version of the cutoff gem
5
5
  def self.version
6
- Gem::Version.new('0.4.2')
6
+ Gem::Version.new('0.5.0')
7
7
  end
8
8
  end
data/lib/cutoff.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal:true
2
2
 
3
3
  require 'set'
4
+ require 'timeout'
4
5
 
5
6
  require 'cutoff/version'
6
7
  require 'cutoff/error'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -112,7 +112,7 @@ licenses:
112
112
  - MIT
113
113
  metadata:
114
114
  changelog_uri: https://github.com/justinhoward/cutoff/blob/master/CHANGELOG.md
115
- documentation_uri: https://www.rubydoc.info/gems/cutoff/0.4.2
115
+ documentation_uri: https://www.rubydoc.info/gems/cutoff/0.5.0
116
116
  post_install_message:
117
117
  rdoc_options: []
118
118
  require_paths: