async 2.3.1 → 2.4.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: 042a45792628d56b89e02200e38d6d00fb16c5311b95c3dae7d52607aef8108a
4
- data.tar.gz: 6e7b3271d484ee3aabe395996ca987b1e0043d6d8710b3b706688993df43c916
3
+ metadata.gz: '0496bec665a4c9cb59cc9f52e0f75e8c122ff66b2daddaa0aa6e83022e5e8928'
4
+ data.tar.gz: 2e0c3995dc1de72fee48942eecf96b14fa08f8e0d78083fba96be455a0ffdeab
5
5
  SHA512:
6
- metadata.gz: 49ea21f4f81b9e566119265b834ecbfb4de8db83788370e18d3d27b14e7a2ec972960f67301139dd61111f13843325264412bf096b5b33cafff910630b1663cb
7
- data.tar.gz: 151eee11c70bf263c72cae52142168449ba38cd68a00ad302c2c9fcf53088de65784f35193971628e6c1ddb9d7efab9677359040ed19e13cde1f846670fd9b3e
6
+ metadata.gz: cac34c61bf2bde2775d0abbf4185fdecc07f6540ba18017c90ce38ef6d72d95397e09c65b8d9f25f8e3a1ead9635180b38d6666525c00384810c796c6c92d629
7
+ data.tar.gz: 39778867ad4784cf5f44d164f2d97f52d2cc43b869f267242ef5d9d588f626cc656bb01d7f935a8237f9f83ff50bf9b1371032f50ffb5bc39a1af80e2be89adc
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2022, by Samuel Williams.
4
+ # Copyright, 2018-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'list'
7
7
 
@@ -28,6 +28,25 @@ module Async
28
28
  # The tasks waiting on this semaphore.
29
29
  attr :waiting
30
30
 
31
+ # Allow setting the limit. This is useful for cases where the semaphore is used to limit the number of concurrent tasks, but the number of tasks is not known in advance or needs to be modified.
32
+ #
33
+ # On increasing the limit, some tasks may be immediately resumed. On decreasing the limit, some tasks may execute until the count is < than the limit.
34
+ #
35
+ # @parameter limit [Integer] The new limit.
36
+ def limit= limit
37
+ difference = limit - @limit
38
+ @limit = limit
39
+
40
+ # We can't suspend
41
+ if difference > 0
42
+ difference.times do
43
+ break unless node = @waiting.first
44
+
45
+ node.resume
46
+ end
47
+ end
48
+ end
49
+
31
50
  # Is the semaphore currently acquired?
32
51
  def empty?
33
52
  @count.zero?
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2022, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.3.1"
7
+ VERSION = "2.4.0"
8
8
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2017-2022, by Samuel Williams.
3
+ Copyright, 2017-2023, by Samuel Williams.
4
4
  Copyright, 2017, by Kent Gruber.
5
5
  Copyright, 2017, by Devin Christensen.
6
6
  Copyright, 2018, by Sokolov Yura.
@@ -17,6 +17,9 @@ Copyright, 2020, by Jun Jiang.
17
17
  Copyright, 2020-2022, by Bruno Sutic.
18
18
  Copyright, 2021, by Julien Portalier.
19
19
  Copyright, 2022, by Shannon Skipper.
20
+ Copyright, 2022, by Masafumi Okura.
21
+ Copyright, 2022, by Trevor Turk.
22
+ Copyright, 2022, by Masayuki Yamamoto.
20
23
 
21
24
  Permission is hereby granted, free of charge, to any person obtaining a copy
22
25
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -42,27 +42,3 @@ We welcome contributions to this project.
42
42
  - [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`.
43
43
  - [rubydns](https://github.com/ioquatix/rubydns) — An easy to use Ruby DNS server.
44
44
  - [slack-ruby-bot](https://github.com/slack-ruby/slack-ruby-bot) — A client for making slack bots.
45
-
46
- ## License
47
-
48
- Released under the MIT license.
49
-
50
- Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com).
51
-
52
- Permission is hereby granted, free of charge, to any person obtaining a copy
53
- of this software and associated documentation files (the "Software"), to deal
54
- in the Software without restriction, including without limitation the rights
55
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56
- copies of the Software, and to permit persons to whom the Software is
57
- furnished to do so, subject to the following conditions:
58
-
59
- The above copyright notice and this permission notice shall be included in
60
- all copies or substantial portions of the Software.
61
-
62
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
68
- THE SOFTWARE.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,27 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Bruno Sutic
9
- - Devin Christensen
10
9
  - Jeremy Jung
10
+ - Devin Christensen
11
11
  - Kent Gruber
12
- - jeremyjung
13
12
  - Brian Morearty
14
13
  - Jiang Jinyang
15
14
  - Julien Portalier
15
+ - Jun Jiang
16
+ - Ken Muryoi
17
+ - Masafumi Okura
18
+ - Masayuki Yamamoto
16
19
  - Olle Jonsson
17
20
  - Patrik Wenger
18
21
  - Ryan Musgrave
19
22
  - Salim Semaoune
20
23
  - Shannon Skipper
21
- - Sokolov Yura aka funny_falcon
24
+ - Sokolov Yura
22
25
  - Stefan Wrobel
23
- - jasl
24
- - muryoimpl
26
+ - Trevor Turk
25
27
  autorequire:
26
28
  bindir: bin
27
29
  cert_chain:
@@ -54,7 +56,7 @@ cert_chain:
54
56
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
55
57
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
56
58
  -----END CERTIFICATE-----
57
- date: 2022-12-28 00:00:00.000000000 Z
59
+ date: 2023-03-01 00:00:00.000000000 Z
58
60
  dependencies:
59
61
  - !ruby/object:Gem::Dependency
60
62
  name: console
@@ -259,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
261
  - !ruby/object:Gem::Version
260
262
  version: '0'
261
263
  requirements: []
262
- rubygems_version: 3.4.1
264
+ rubygems_version: 3.4.7
263
265
  signing_key:
264
266
  specification_version: 4
265
267
  summary: A concurrency framework for Ruby.
metadata.gz.sig CHANGED
Binary file