async-service 0.20.0 → 0.21.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: dbf0b6499a4433f09585491d1097e280a739775f24557f57ea89a5f7e1c345f1
4
- data.tar.gz: 7ffe1c3251852c4a57b6ad70f0e9d89f461bb272eef48cb9556f17e21369c6a6
3
+ metadata.gz: de59afc9bb1a297f08d89797f5cc1cab814aadb6fd867773a70a3c2b83bcf1d7
4
+ data.tar.gz: 07c8402c361ae967fd593616d1777367118687fa490b9bb8e5cb5e64003280c0
5
5
  SHA512:
6
- metadata.gz: 477ed5f425e11f46b91da568ab84af8c32b74b873ed0909579cbad67b787a2c9230ae9aea871ae42fcb413437b5879b2ae36673c7c1a8a1117f27f759c2494cb
7
- data.tar.gz: 83ec254a0835ea322ffdad5f41cfbf76ab322f739db150ab97ddecf8503b2f08408025e06613e552270f18dc9b9e3d5c934f62e7a0020e121fc55e0c13a45fef
6
+ metadata.gz: 777190197a4272ce2f8c726abdbf1b018e46af424ca68d9fbfa4eba8490912e3c9cbb9579490743bbddf384a3b4fa2159f38ec9d58c013badd9ce4642f9bfb68
7
+ data.tar.gz: 5976d4d560ddcb71e781bdd1ec9a304f7851ed3cb76f1f1d82fb590765fd4137cd463afabb4da78abead51f328ce5d55cd3b45d272056fa765be086c1531c835
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2024-2025, by Samuel Williams.
5
+
6
+ def initialize(context)
7
+ super
8
+
9
+ require "async/service/configuration"
10
+
11
+ @configuration = Async::Service::Configuration.new
12
+ end
13
+
14
+ attr :configuration
15
+
16
+ # Load the configuration from the given path.
17
+ # @parameter path [String] The path to the configuration file.
18
+ def load(path)
19
+ @configuration.load_file(path)
20
+ end
21
+
22
+ # List the available environments (all named environments).
23
+ def list
24
+ @configuration.environments.map(&:to_h)
25
+ end
26
+
27
+ # List the available services (those that define a service class).
28
+ def services
29
+ @configuration.services.map(&:to_h)
30
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
+
6
+ def initialize(context)
7
+ super
8
+
9
+ require "async/service/controller"
10
+ end
11
+
12
+ def run
13
+ controller.run
14
+ end
15
+
16
+ private
17
+
18
+ def controller
19
+ configuration = context.lookup("async:service:configuration").instance.configuration
20
+
21
+ return configuration.make_controller
22
+ end
@@ -51,8 +51,8 @@ module Async
51
51
  rate = container.statistics.failure_rate.per_second
52
52
 
53
53
  if rate > @failure_rate_threshold
54
- # Only stop if container is still running (avoid redundant stop calls during shutdown)
55
- if container.running?
54
+ # Only stop if container is not already stopping
55
+ unless container.stopping?
56
56
  Console.error(self, "Failure rate exceeded threshold, stopping container!",
57
57
  rate: rate,
58
58
  threshold: @failure_rate_threshold
@@ -7,6 +7,6 @@
7
7
  module Async
8
8
  # @namespace
9
9
  module Service
10
- VERSION = "0.20.0"
10
+ VERSION = "0.21.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -31,6 +31,10 @@ 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.20.1
35
+
36
+ - Use `container.stopping?` in policy to prevent redundant stop calls during graceful shutdown.
37
+
34
38
  ### v0.20.0
35
39
 
36
40
  - Introduce `Async::Service::Policy` for monitoring service health and implementing failure handling strategies. Default threshold: 6 failures in 60 seconds (0.1 failures/second).
@@ -79,10 +83,6 @@ Please see the [project releases](https://socketry.github.io/async-service/relea
79
83
 
80
84
  - Use `String::Format` gem for formatting.
81
85
 
82
- ### v0.14.0
83
-
84
- - Introduce `ContainerEnvironment` and `ContainerService` for implementing best-practice services.
85
-
86
86
  ## Contributing
87
87
 
88
88
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.20.1
4
+
5
+ - Use `container.stopping?` in policy to prevent redundant stop calls during graceful shutdown.
6
+
3
7
  ## v0.20.0
4
8
 
5
9
  - Introduce `Async::Service::Policy` for monitoring service health and implementing failure handling strategies. Default threshold: 6 failures in 60 seconds (0.1 failures/second).
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.20.0
4
+ version: 0.21.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.33'
61
+ version: '0.34'
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.33'
68
+ version: '0.34'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: string-format
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +85,8 @@ executables:
85
85
  extensions: []
86
86
  extra_rdoc_files: []
87
87
  files:
88
+ - bake/async/service/configuration.rb
89
+ - bake/async/service/controller.rb
88
90
  - bin/async-service
89
91
  - context/best-practices.md
90
92
  - context/deployment.md
@@ -124,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
126
  requirements:
125
127
  - - ">="
126
128
  - !ruby/object:Gem::Version
127
- version: '3.2'
129
+ version: '3.3'
128
130
  required_rubygems_version: !ruby/object:Gem::Requirement
129
131
  requirements:
130
132
  - - ">="
metadata.gz.sig CHANGED
Binary file