async-limiter 2.2.0 → 2.3.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/limiter/generic.rb +3 -0
- data/lib/async/limiter/token.rb +15 -1
- data/lib/async/limiter/version.rb +1 -1
- data/readme.md +5 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20ea7fcd7cb0c04777113d99878872f59f2275d7df572555eb23e5176173103a
|
|
4
|
+
data.tar.gz: 65bd9ebbc338f9cb786adb711f01085b8e3fdade9ed5d8a5614a3710023a5863
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbd5950c897046843d3cd9da278843aab29a46d5a4e6f2915dc971596353e97edeec4da100553f243eb31661243a51a05fbc3232758521fdf8840ddcddd7fd58
|
|
7
|
+
data.tar.gz: 4e1a47617c6239470ba15351d22f310d082062358159e7c9595f42a160ea87a694f9cd52a25daaaa19a6d42983c0869dd5580e31f97a7dcd3603de4e056d84cf
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/async/limiter/token.rb
CHANGED
|
@@ -14,7 +14,8 @@ module Async
|
|
|
14
14
|
# re-acquisition with modified parameters while maintaining the original context.
|
|
15
15
|
#
|
|
16
16
|
# The token automatically tracks release state using the resource itself as the
|
|
17
|
-
# state indicator (nil = released, non-nil = acquired).
|
|
17
|
+
# state indicator (nil = released, non-nil = acquired). A closed token also
|
|
18
|
+
# clears its limiter reference, which prevents future re-acquisition.
|
|
18
19
|
class Token
|
|
19
20
|
# Acquire a token from a limiter.
|
|
20
21
|
#
|
|
@@ -61,6 +62,12 @@ module Async
|
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
|
|
65
|
+
# Close the token and prevent future re-acquisition.
|
|
66
|
+
def close
|
|
67
|
+
self.release
|
|
68
|
+
@limiter = nil
|
|
69
|
+
end
|
|
70
|
+
|
|
64
71
|
# Re-acquire the resource with modified options.
|
|
65
72
|
#
|
|
66
73
|
# This allows changing acquisition parameters (timeout, cost, priority, etc.)
|
|
@@ -74,6 +81,7 @@ module Async
|
|
|
74
81
|
# @asynchronous
|
|
75
82
|
def acquire(**options, &block)
|
|
76
83
|
raise "Token already acquired!" if @resource
|
|
84
|
+
return nil unless @limiter
|
|
77
85
|
|
|
78
86
|
@resource = @limiter.acquire(reacquire: true, **options)
|
|
79
87
|
|
|
@@ -97,6 +105,12 @@ module Async
|
|
|
97
105
|
def released?
|
|
98
106
|
!@resource
|
|
99
107
|
end
|
|
108
|
+
|
|
109
|
+
# Check if the token has been closed.
|
|
110
|
+
# @returns [Boolean] True if the token has been closed.
|
|
111
|
+
def closed?
|
|
112
|
+
!@limiter
|
|
113
|
+
end
|
|
100
114
|
end
|
|
101
115
|
end
|
|
102
116
|
end
|
data/readme.md
CHANGED
|
@@ -24,6 +24,11 @@ Please see the [project documentation](https://socketry.github.io/async-limiter/
|
|
|
24
24
|
|
|
25
25
|
Please see the [project releases](https://socketry.github.io/async-limiter/releases/index) for all releases.
|
|
26
26
|
|
|
27
|
+
### v2.3.0
|
|
28
|
+
|
|
29
|
+
- Add `Async::Limiter::Token#close` to release and permanently invalidate a token.
|
|
30
|
+
- Expose `Async::Limiter::Generic#timing`.
|
|
31
|
+
|
|
27
32
|
### v2.2.0
|
|
28
33
|
|
|
29
34
|
- Add `async-utilization` metrics for limiter telemetry counters.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: async-limiter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bruno Sutic
|
|
@@ -100,7 +100,7 @@ files:
|
|
|
100
100
|
- license.md
|
|
101
101
|
- readme.md
|
|
102
102
|
- releases.md
|
|
103
|
-
homepage: https://github.com/
|
|
103
|
+
homepage: https://github.com/socketry/async-limiter
|
|
104
104
|
licenses:
|
|
105
105
|
- MIT
|
|
106
106
|
metadata:
|
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
121
|
version: '0'
|
|
122
122
|
requirements: []
|
|
123
|
-
rubygems_version: 4.0.
|
|
123
|
+
rubygems_version: 4.0.3
|
|
124
124
|
specification_version: 4
|
|
125
125
|
summary: Execution rate limiting for Async
|
|
126
126
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|