async 2.21.3 → 2.22.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cc69a2f9c734662ef143958e58fc4c9af45d7a05a0910570457c328fb488fca
4
- data.tar.gz: b1149b22d3dc693e411efa942fe36841f7ce9120050b370addc309e270ba7965
3
+ metadata.gz: ef8aa467e82d3ddcd2c24a823ffba2e2b9e1680d005fade667ef36c882588dd1
4
+ data.tar.gz: c2df7e4669fe9d2f0bb8d6c6f7de673d1a89e41d8ffc99bf702f79cefbce7a3e
5
5
  SHA512:
6
- metadata.gz: f8930f0303101bc429bc7cc9f9120e516699559af0ee1b73af95c957e9bc3c1cfd9dcca45ce14a99ed86d78fc4a2cce6eb77f64f46fbde2db61d028aa4c89739
7
- data.tar.gz: 359e97fb5805e6b7bef879aad71df0f72a53584b806c30f4a5a52e1f26f4dce1e9e21f20b01c5d79fb714857d53d78232c2c209ce959c806b81b358f63aa452b
6
+ metadata.gz: 2a98aaf33872cafab28e41acf187425926a3e0423ee5017bfd42fef66e64f55ad0ec6d6d1a053987813a3f190471e4521bac7c8895fb1ee352b8e984cf1dd326
7
+ data.tar.gz: 64205b564a8de8aeb22d0ae6834ea9dfd114439336e7bd076de489da0e045f002a9d90f51f72414c36ed006a599cd536d27ff852b5f8f9541f3c656c3d9e7035
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/async/barrier.md CHANGED
@@ -18,7 +18,7 @@ Sync do
18
18
  # Sleep sort the numbers:
19
19
  numbers.each do |number|
20
20
  barrier.async do |task|
21
- task.sleep(number)
21
+ sleep(number)
22
22
  sorted << number
23
23
  end
24
24
  end
data/lib/async/clock.rb CHANGED
@@ -61,5 +61,14 @@ module Async
61
61
 
62
62
  return total
63
63
  end
64
+
65
+ # Reset the total elapsed time. If the clock is currently running, reset the start time to now.
66
+ def reset!
67
+ @total = 0
68
+
69
+ if @started
70
+ @started = Clock.now
71
+ end
72
+ end
64
73
  end
65
74
  end
@@ -15,7 +15,7 @@ Sync do
15
15
  end
16
16
 
17
17
  Async do |task|
18
- task.sleep(1)
18
+ sleep(1)
19
19
  Console.info "Signalling condition..."
20
20
  condition.signal("Hello World")
21
21
  end
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.21.3"
7
+ VERSION = "2.22.0"
8
8
  end
@@ -8,10 +8,15 @@ require "metrics/provider"
8
8
 
9
9
  Metrics::Provider(Async::Task) do
10
10
  ASYNC_TASK_SCHEDULED = Metrics.metric("async.task.scheduled", :counter, description: "The number of tasks scheduled.")
11
+ ASYNC_TASK_FINISHED = Metrics.metric("async.task.finished", :counter, description: "The number of tasks finished.")
11
12
 
12
13
  def schedule(&block)
13
14
  ASYNC_TASK_SCHEDULED.emit(1)
14
15
 
15
16
  super(&block)
17
+ rescue => error
18
+ raise
19
+ ensure
20
+ ASYNC_TASK_FINISHED.emit(1)
16
21
  end
17
22
  end
data/readme.md CHANGED
@@ -24,7 +24,7 @@ Please see the [project documentation](https://socketry.github.io/async/) for mo
24
24
 
25
25
  - [Asynchronous Tasks](https://socketry.github.io/async/guides/asynchronous-tasks/index) - This guide explains how asynchronous tasks work and how to use them.
26
26
 
27
- - [Event Loop](https://socketry.github.io/async/guides/event-loop/index) - This guide gives an overview of how the event loop is implemented.
27
+ - [Scheduler](https://socketry.github.io/async/guides/scheduler/index) - This guide gives an overview of how the scheduler is implemented.
28
28
 
29
29
  - [Compatibility](https://socketry.github.io/async/guides/compatibility/index) - This guide gives an overview of the compatibility of Async with Ruby and other frameworks.
30
30
 
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.21.3
4
+ version: 2.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -62,7 +62,7 @@ cert_chain:
62
62
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
63
63
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
64
64
  -----END CERTIFICATE-----
65
- date: 2025-01-31 00:00:00.000000000 Z
65
+ date: 2025-02-07 00:00:00.000000000 Z
66
66
  dependencies:
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: console
metadata.gz.sig CHANGED
Binary file