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 +4 -4
- data/CHANGELOG.md +22 -1
- data/lib/cutoff/error.rb +4 -2
- data/lib/cutoff/timer.rb +8 -9
- data/lib/cutoff/version.rb +1 -1
- data/lib/cutoff.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d13746c455ac05f8491ccd8e5f8834370c0e4d41b77b440a2ee33f7c9bafb9db
|
4
|
+
data.tar.gz: 883490b2c6661605d81cf299f809175cadfd1e51b4c68bb218dfa8f996af23cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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 <
|
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::
|
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
|
10
|
-
# system
|
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
|
-
#
|
13
|
-
|
14
|
-
|
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
|
data/lib/cutoff/version.rb
CHANGED
data/lib/cutoff.rb
CHANGED
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
|
+
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:
|
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.
|
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:
|