async-service 0.17.0 → 0.18.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: 6e9258424ee834d70b309984ba6f2d0c89f87ed9b2a16ec38fb298dfafb33fcd
4
- data.tar.gz: e91b2129702c7c8ad7f3203063d3dd526b8e6e91d322bb84388afe873cf638f0
3
+ metadata.gz: a7fd9e53ca4f30c0166fb518aa104d292d67543377a6c93fa5df01b85148330d
4
+ data.tar.gz: ba8d1d6f6c994a40a7e7ff7536a81444faa9ebf01f087933a94ee1a3f590f6c0
5
5
  SHA512:
6
- metadata.gz: edc78ce3ff189ef951f19b206d02bbef4f2c121b10e24f074b6a7eab702c6ffeceb5e47c7c29d330363c7389c721b371c4584f33b9145cde42b798ec08e47237
7
- data.tar.gz: be8a666be488d9d428339edea966834c0a7d5e935bcf330b8669f914b58661ed11deff0782b4202327951b108063992e5ac6f4fb9427beca5d6c1daaf09f440a
6
+ metadata.gz: 74126e6fff458ce042d8233f148f8dd8042d8d26fce12bfea98a6d3622310bd5f8b3216344486391cdb9a60ee38416f6c3b2061228dc0fd2384c9034fddf53e1
7
+ data.tar.gz: 32572d45278190114e722909e14cd1d3bf3abcb66c17e5a70d97e4a0ed85ab0f323959e93a5b1bb46955897f9fc34ea6a2de66728b96ab43ed02321a2f94245c
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- )�r����̖Zr�+��rؠ�
2
- ���y�
3
- ��x��(��r�i�eUb���� �Z�nȀ��x|c�w�jO��<�R����s'��M`F�ǿ�h`�m����Y��@�L>_���FW��b����42�~|��O5�6ƃܳRj!ۅ�pyg���_�nقD���s�5_yHK\�Ph��7;݉->#RU�u�N
1
+ &<�'j�',l����EA�c,ԝ�o���9��Pd���_�mHL7���]�1��Ȳf$h��ՑZ���DE�W�y6��p/b�^���2�pk�ʻ�r��*�LR�+!c��c� T�9�S��ܢH�7�Ʒ�J M�����������ӰS�e:G��2cKUc��;(�U+�ẓ�1��.^�yF1�9_s���g�s&
2
+ �Xuyov����*3��'��!����H� ��M�A7�i����,(�f-���&|��l��#��%%��Č^��(�N���€H�­ሿ5���>bIhk�s���HG=�NLLXFn�$$�0_����5���3����9��3�Y�
3
+ 
@@ -21,7 +21,12 @@ module Async
21
21
  configuration = self.new
22
22
 
23
23
  loader = Loader.new(configuration, root)
24
- loader.instance_eval(&block)
24
+
25
+ if block.arity == 0
26
+ loader.instance_eval(&block)
27
+ else
28
+ yield loader
29
+ end
25
30
 
26
31
  return configuration
27
32
  end
@@ -28,10 +28,10 @@ module Async
28
28
  # We deliberately create a fiber here, to confirm that fiber creation is working.
29
29
  # If something has gone wrong with fiber allocation, we will crash here, and that's okay.
30
30
  Fiber.new do
31
- instance.ready!
31
+ instance.healthy!
32
32
  end.resume
33
33
 
34
- sleep(timeout / 2)
34
+ sleep(timeout / 2.0)
35
35
  end
36
36
  end
37
37
  else
@@ -39,7 +39,7 @@ module Async
39
39
  yield(instance)
40
40
  end
41
41
 
42
- instance.ready!
42
+ instance.healthy!
43
43
  end
44
44
  end
45
45
  end
@@ -59,9 +59,10 @@ module Async
59
59
  # Override this method to emit metrics, logs, or perform other actions when the service preparation is complete.
60
60
  #
61
61
  # @parameter instance [Async::Container::Instance] The container instance.
62
- # @parameter start_time [Async::Clock] The monotonic start time from {Async::Clock.start}.
63
- def emit_prepared(instance, start_time)
62
+ # @parameter clock [Async::Clock] The monotonic start time from {Async::Clock.start}.
63
+ def emit_prepared(instance, clock)
64
64
  # Override in subclasses as needed.
65
+ Console.info(self, "Prepared...", duration: clock.total)
65
66
  end
66
67
 
67
68
  # Called after the service has started running.
@@ -69,9 +70,10 @@ module Async
69
70
  # Override this method to emit metrics, logs, or perform other actions when the service begins running.
70
71
  #
71
72
  # @parameter instance [Async::Container::Instance] The container instance.
72
- # @parameter start_time [Async::Clock] The monotonic start time from {Async::Clock.start}.
73
- def emit_running(instance, start_time)
73
+ # @parameter clock [Async::Clock] The monotonic start time from {Async::Clock.start}.
74
+ def emit_running(instance, clock)
74
75
  # Override in subclasses as needed.
76
+ Console.info(self, "Running...", duration: clock.total)
75
77
  end
76
78
 
77
79
  # Set up the container with health checking and process title formatting.
@@ -83,22 +85,27 @@ module Async
83
85
  health_check_timeout = container_options[:health_check_timeout]
84
86
 
85
87
  container.run(**container_options) do |instance|
86
- start_time = Async::Clock.start
88
+ clock = Async::Clock.start
87
89
 
88
90
  Async do
89
91
  evaluator = self.environment.evaluator
92
+ server = nil
93
+
94
+ health_checker(instance, health_check_timeout) do
95
+ if server
96
+ instance.name = format_title(evaluator, server)
97
+ end
98
+ end
90
99
 
91
100
  instance.status!("Preparing...")
92
101
  evaluator.prepare!(instance)
93
- emit_prepared(instance, start_time)
102
+ emit_prepared(instance, clock)
94
103
 
95
104
  instance.status!("Running...")
96
105
  server = run(instance, evaluator)
97
- emit_running(instance, start_time)
106
+ emit_running(instance, clock)
98
107
 
99
- health_checker(instance) do
100
- instance.name = format_title(evaluator, server)
101
- end
108
+ instance.ready!
102
109
  end
103
110
  end
104
111
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Service
8
- VERSION = "0.17.0"
8
+ VERSION = "0.18.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -29,6 +29,12 @@ Please see the [project documentation](https://socketry.github.io/async-service/
29
29
 
30
30
  Please see the [project releases](https://socketry.github.io/async-service/releases/index) for all releases.
31
31
 
32
+ ### v0.18.0
33
+
34
+ - Start health checker earlier in the process. Use `#healthy!` message instead of `#ready!`.
35
+ - Emit prepared and running log messages with durations (e.g. how long it took to transition to prepared and running states).
36
+ - `Async::Service::Configuration.build{|loader|...}` can now take an argument for more flexible configuration construction.
37
+
32
38
  ### v0.17.0
33
39
 
34
40
  - `ManagedService` now sends `status!` messages during startup to prevent premature health check timeouts for slow-starting services.
@@ -72,11 +78,6 @@ Please see the [project releases](https://socketry.github.io/async-service/relea
72
78
 
73
79
  - Allow builder with argument for more flexible configuration construction.
74
80
 
75
- ### v0.10.0
76
-
77
- - Add `Environment::Evaluator#as_json` for JSON serialization support.
78
- - Allow constructing a configuration with existing environments.
79
-
80
81
  ## Contributing
81
82
 
82
83
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Releases
2
2
 
3
+ ## v0.18.0
4
+
5
+ - Start health checker earlier in the process. Use `#healthy!` message instead of `#ready!`.
6
+ - Emit prepared and running log messages with durations (e.g. how long it took to transition to prepared and running states).
7
+ - `Async::Service::Configuration.build{|loader|...}` can now take an argument for more flexible configuration construction.
8
+
3
9
  ## v0.17.0
4
10
 
5
11
  - `ManagedService` now sends `status!` messages during startup to prevent premature health check timeouts for slow-starting services.
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.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.28'
61
+ version: '0.29'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.28'
68
+ version: '0.29'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: string-format
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 4.0.3
129
+ rubygems_version: 3.6.9
130
130
  specification_version: 4
131
131
  summary: A service layer for Async.
132
132
  test_files: []
metadata.gz.sig CHANGED
Binary file