async 2.27.4 → 2.28.1

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
  SHA256:
3
- metadata.gz: 2231cc467de066011727840c1b920b6e5b73e3e3f93c1e899a63b029386e8d71
4
- data.tar.gz: 2b6b38402df6fe44e6c00409263e336df91adc2ad99262e905227e8dbd60138d
3
+ metadata.gz: efc7dde75b60834caa61f17a3f742ff7836422c0dbc8ab6dc0f67392c00bff0e
4
+ data.tar.gz: ee3ffc8bab4adc4f98c5df81dda26f74266eb12512aba815b65cab587bb280e5
5
5
  SHA512:
6
- metadata.gz: e1f5963baf4efecc92493ac6199e196360688a076eaaa8dbd77aa836baab7ef0f5d9fa42753052e078ec9617f6d9536411f62978000b2c9453390a81a67ac352
7
- data.tar.gz: f2729d26181a95a16ed26b8ed561c95249ae9a10f5ee952adab944327e97cc5eac7c940bf943f3ce8ba74e7f1ec927ec644427dd0f0eb9849762a38d4e18de47
6
+ metadata.gz: 239dfdc750425c0ac90abdf981faa3358593b2d4aa782897e9b7b073fddff04d631606d6bd61d60904fbdd71fb91536dddae5b63343d831a850d67d7ee9782b7
7
+ data.tar.gz: 83d4af2ab658fef715ad268cb936bbc30851948135b935191d7bdaecad45d7eef9d3f988b8c0857129d4bff0d58648724410ee16671639a7c64d718526e7a175
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/async/barrier.rb CHANGED
@@ -43,6 +43,8 @@ module Async
43
43
  # Execute a child task and add it to the barrier.
44
44
  # @asynchronous Executes the given block concurrently.
45
45
  def async(*arguments, parent: (@parent or Task.current), **options, &block)
46
+ raise "Barrier is stopped!" if @finished.closed?
47
+
46
48
  waiting = nil
47
49
 
48
50
  parent.async(*arguments, **options) do |task, *arguments|
@@ -50,7 +52,7 @@ module Async
50
52
  @tasks.append(waiting)
51
53
  block.call(task, *arguments)
52
54
  ensure
53
- @finished.signal(waiting)
55
+ @finished.signal(waiting) unless @finished.closed?
54
56
  end
55
57
  end
56
58
 
data/lib/async/node.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2024, by Samuel Williams.
4
+ # Copyright, 2017-2025, by Samuel Williams.
5
5
  # Copyright, 2017, by Kent Gruber.
6
6
  # Copyright, 2022, by Shannon Skipper.
7
7
  # Copyright, 2025, by Shopify Inc.
data/lib/async/queue.rb CHANGED
@@ -32,6 +32,11 @@ module Async
32
32
  @available = available
33
33
  end
34
34
 
35
+ # @returns [Boolean] Whether the queue is closed.
36
+ def closed?
37
+ @closed
38
+ end
39
+
35
40
  # Close the queue, causing all waiting tasks to return `nil`. Any subsequent calls to {enqueue} will raise an exception.
36
41
  def close
37
42
  @closed = true
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.27.4"
7
+ VERSION = "2.28.1"
8
8
  end
@@ -14,7 +14,7 @@ Traces::Provider(Async::Task) do
14
14
  end
15
15
 
16
16
  unless self.transient?
17
- trace_context = Traces.trace_context
17
+ trace_context = Traces.current_context
18
18
  end
19
19
 
20
20
  attributes = {
@@ -25,7 +25,7 @@ Traces::Provider(Async::Task) do
25
25
 
26
26
  # Run the trace in the context of the child task:
27
27
  super do
28
- Traces.trace_context = trace_context
28
+ Traces.with_context(trace_context)
29
29
 
30
30
  if annotation = self.annotation
31
31
  attributes["annotation"] = annotation
data/license.md CHANGED
@@ -32,6 +32,8 @@ Copyright, 2025, by Mark Montroy.
32
32
  Copyright, 2025, by Shigeru Nakajima.
33
33
  Copyright, 2025, by Alan Wu.
34
34
  Copyright, 2025, by Shopify Inc.
35
+ Copyright, 2025, by Josh Teeter.
36
+ Copyright, 2025, by Jatin Goyal.
35
37
 
36
38
  Permission is hereby granted, free of charge, to any person obtaining a copy
37
39
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -35,6 +35,14 @@ Please see the [project documentation](https://socketry.github.io/async/) for mo
35
35
 
36
36
  Please see the [project releases](https://socketry.github.io/async/releases/index) for all releases.
37
37
 
38
+ ### v2.28.1
39
+
40
+ - Fix race condition between `Async::Barrier#stop` and finish signalling.
41
+
42
+ ### v2.28.0
43
+
44
+ - Use `Traces.current_context` and `Traces.with_context` for better integration with OpenTelemetry.
45
+
38
46
  ### v2.27.4
39
47
 
40
48
  - Suppress excessive warning in `Async::Scheduler#async`.
@@ -79,15 +87,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
79
87
  - `Async::Wrapper` which was previously deprecated, is now removed.
80
88
  - [Flexible Timeouts](https://socketry.github.io/async/releases/index#flexible-timeouts)
81
89
 
82
- ### v2.23.0
83
-
84
- - Rename `ASYNC_SCHEDULER_DEFAULT_WORKER_POOL` to `ASYNC_SCHEDULER_WORKER_POOL`.
85
- - [Fiber Stall Profiler](https://socketry.github.io/async/releases/index#fiber-stall-profiler)
86
-
87
- ### v2.21.1
88
-
89
- - [Worker Pool](https://socketry.github.io/async/releases/index#worker-pool)
90
-
91
90
  ## See Also
92
91
 
93
92
  - [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v2.28.1
4
+
5
+ - Fix race condition between `Async::Barrier#stop` and finish signalling.
6
+
7
+ ## v2.28.0
8
+
9
+ - Use `Traces.current_context` and `Traces.with_context` for better integration with OpenTelemetry.
10
+
3
11
  ## v2.27.4
4
12
 
5
13
  - Suppress excessive warning in `Async::Scheduler#async`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.27.4
4
+ version: 2.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -20,7 +20,9 @@ authors:
20
20
  - Dimitar Peychinov
21
21
  - Gert Goet
22
22
  - Jahfer Husain
23
+ - Jatin Goyal
23
24
  - Jiang Jinyang
25
+ - Josh Teeter
24
26
  - Julien Portalier
25
27
  - Jun Jiang
26
28
  - Ken Muryoi
@@ -131,14 +133,14 @@ dependencies:
131
133
  requirements:
132
134
  - - "~>"
133
135
  - !ruby/object:Gem::Version
134
- version: '0.15'
136
+ version: '0.18'
135
137
  type: :runtime
136
138
  prerelease: false
137
139
  version_requirements: !ruby/object:Gem::Requirement
138
140
  requirements:
139
141
  - - "~>"
140
142
  - !ruby/object:Gem::Version
141
- version: '0.15'
143
+ version: '0.18'
142
144
  executables: []
143
145
  extensions: []
144
146
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file