async-service 0.21.0 → 0.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: de59afc9bb1a297f08d89797f5cc1cab814aadb6fd867773a70a3c2b83bcf1d7
4
- data.tar.gz: 07c8402c361ae967fd593616d1777367118687fa490b9bb8e5cb5e64003280c0
3
+ metadata.gz: b34c255ee7608b446acf8a57e86b876644f34eb21d5afa6b2a35d8f6235bb718
4
+ data.tar.gz: 66b3494d6bdfb347e1ae6b1440261754132a70fa903743f5d50dc19d636ef13e
5
5
  SHA512:
6
- metadata.gz: 777190197a4272ce2f8c726abdbf1b018e46af424ca68d9fbfa4eba8490912e3c9cbb9579490743bbddf384a3b4fa2159f38ec9d58c013badd9ce4642f9bfb68
7
- data.tar.gz: 5976d4d560ddcb71e781bdd1ec9a304f7851ed3cb76f1f1d82fb590765fd4137cd463afabb4da78abead51f328ce5d55cd3b45d272056fa765be086c1531c835
6
+ metadata.gz: bc3919f55bbf3221098522a47ecc4d744cdabc97f958d4b5d63dc8ed350c4f778b414acda577304a1a2b6493132abf01562f333a67bd84f348feab260d20c9ad
7
+ data.tar.gz: 9adf428ca9ddd8eb76aa0adcd67ab60268fa49bfe118d868b5fca6a75aa27749a4576f1f437f2e94855bcb2fd1013dd06ec4e8c4ec801b8c4cd99ddbbd77bf5d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,32 +10,28 @@ module Async
10
10
  module HealthChecker
11
11
  # Start the health checker.
12
12
  #
13
- # If a timeout is specified, a transient child task will be scheduled, which will yield the instance if a block is given, then mark the instance as ready, and finally sleep for half the health check duration (so that we guarantee that the health check runs in time).
13
+ # If a timeout is specified, a transient child task will be scheduled which will mark the instance as healthy, sleep for half the health check duration (so that we guarantee that the health check runs in time), and then yield the instance if a block is given. This repeats indefinitely.
14
14
  #
15
- # If a timeout is not specified, the health checker will yield the instance immediately and then mark the instance as ready.
15
+ # If a timeout is not specified, the instance is marked as healthy immediately and no task is created. Any block given is ignored.
16
16
  #
17
17
  # @parameter instance [Object] The service instance to check.
18
18
  # @parameter timeout [Numeric] The timeout duration for the health check.
19
19
  # @parameter parent [Async::Task] The parent task to run the health checker in.
20
- # @yields {|instance| ...} If a block is given, it will be called with the service instance at least once.
20
+ # @yields {|instance| ...} If a block is given and a timeout is specified, it will be called with the service instance after each sleep interval.
21
21
  def health_checker(instance, timeout = @evaluator.health_check_timeout, parent: Async::Task.current, &block)
22
22
  if timeout
23
23
  parent.async(transient: true) do
24
24
  while true
25
- if block_given?
26
- yield(instance)
27
- end
28
-
29
25
  instance.healthy!
30
26
 
31
27
  sleep(timeout / 2.0)
28
+
29
+ if block_given?
30
+ yield(instance)
31
+ end
32
32
  end
33
33
  end
34
34
  else
35
- if block_given?
36
- yield(instance)
37
- end
38
-
39
35
  instance.healthy!
40
36
  end
41
37
  end
@@ -93,6 +93,7 @@ module Async
93
93
  evaluator = self.environment.evaluator
94
94
  server = nil
95
95
 
96
+ # If a health check timeout is configured, this block runs periodically to refresh the process title. Without a timeout there is no periodic timer, so the block is never called — the one-shot assignment below handles that case.
96
97
  health_checker(instance, health_check_timeout) do
97
98
  if server
98
99
  instance.name = format_title(evaluator, server)
@@ -105,6 +106,8 @@ module Async
105
106
 
106
107
  instance.status!("Running...")
107
108
  server = run(instance, evaluator)
109
+ # Set the process title immediately once the server is available:
110
+ instance.name = format_title(evaluator, server)
108
111
  emit_running(instance, clock)
109
112
 
110
113
  instance.ready!
@@ -7,6 +7,6 @@
7
7
  module Async
8
8
  # @namespace
9
9
  module Service
10
- VERSION = "0.21.0"
10
+ VERSION = "0.22.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -31,6 +31,14 @@ Please see the [project documentation](https://socketry.github.io/async-service/
31
31
 
32
32
  Please see the [project releases](https://socketry.github.io/async-service/releases/index) for all releases.
33
33
 
34
+ ### v0.22.0
35
+
36
+ - Ensure process title is updated immediately after server starts in `Managed::Service`.
37
+
38
+ ### v0.21.0
39
+
40
+ - Add missing bake files.
41
+
34
42
  ### v0.20.1
35
43
 
36
44
  - Use `container.stopping?` in policy to prevent redundant stop calls during graceful shutdown.
@@ -74,15 +82,6 @@ Please see the [project releases](https://socketry.github.io/async-service/relea
74
82
 
75
83
  - `Managed::Service` should run within `Async do ... end`.
76
84
 
77
- ### v0.15.0
78
-
79
- - Rename `ContainerEnvironment` and `ContainerService` to `Managed::Environment` and `Managed::Service` respectively.
80
- - Health check uses `Fiber.new{instance.ready!}.resume` to confirm fiber allocation is working.
81
-
82
- ### v0.14.4
83
-
84
- - Use `String::Format` gem for formatting.
85
-
86
85
  ## Contributing
87
86
 
88
87
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.22.0
4
+
5
+ - Ensure process title is updated immediately after server starts in `Managed::Service`.
6
+
7
+ ## v0.21.0
8
+
9
+ - Add missing bake files.
10
+
3
11
  ## v0.20.1
4
12
 
5
13
  - Use `container.stopping?` in policy to prevent redundant stop calls during graceful shutdown.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 4.0.3
136
+ rubygems_version: 4.0.6
137
137
  specification_version: 4
138
138
  summary: A service layer for Async.
139
139
  test_files: []
metadata.gz.sig CHANGED
Binary file