async-service 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/async-service +2 -23
- data/lib/async/service/configuration.rb +10 -0
- data/lib/async/service/controller.rb +25 -1
- data/lib/async/service/generic.rb +5 -4
- data/lib/async/service/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d3363e029c4a990a1c3aebe2f246e55996dfdccc8c5a49b7d15c37222ee0334
|
4
|
+
data.tar.gz: cad8af3bf066578fafbcc38f9dd1a0f34800e79c6392811948a99a89dd0b1402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad2bbecc7ecf2598b7ebb103055eb15d773e163cf72b606e8d9c40762afb063ad03567cbc7ccc320934abf391b80e29b3cfeb418e3dc9ea32a6bcdd80d3702e
|
7
|
+
data.tar.gz: 67b80153901e82d6d46961beae562a47162aa236d230fd4ed9f4d7edebe19fd55c7b631928e99061d01e9f06265e270147ad2e84d301978d2cbac76540747888
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/async-service
CHANGED
@@ -2,26 +2,5 @@
|
|
2
2
|
|
3
3
|
require 'async/service'
|
4
4
|
|
5
|
-
configuration = Async::Service::Configuration.
|
6
|
-
|
7
|
-
ARGV.each do |path|
|
8
|
-
configuration.load_file(path)
|
9
|
-
end
|
10
|
-
|
11
|
-
controller = Async::Service::Controller.new(configuration.services)
|
12
|
-
|
13
|
-
begin
|
14
|
-
require 'bundler'
|
15
|
-
Bundler.require(:preload)
|
16
|
-
rescue Bundler::GemfileNotFound, LoadError
|
17
|
-
# Ignore.
|
18
|
-
end
|
19
|
-
|
20
|
-
if Process.respond_to?(:warmup)
|
21
|
-
Process.warmup
|
22
|
-
elsif GC.respond_to?(:compact)
|
23
|
-
3.times{GC.start}
|
24
|
-
GC.compact
|
25
|
-
end
|
26
|
-
|
27
|
-
controller.run
|
5
|
+
configuration = Async::Service::Configuration.load
|
6
|
+
Async::Service::Controller.run(configuration)
|
@@ -12,6 +12,16 @@ module Async
|
|
12
12
|
#
|
13
13
|
# Environments are key-value maps with lazy value resolution. An environment can inherit from a parent environment, which can provide defaults
|
14
14
|
class Configuration
|
15
|
+
def self.load(paths = ARGV)
|
16
|
+
configuration = self.new
|
17
|
+
|
18
|
+
paths.each do |path|
|
19
|
+
configuration.load_file(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
return configuration
|
23
|
+
end
|
24
|
+
|
15
25
|
# Initialize an empty configuration.
|
16
26
|
def initialize
|
17
27
|
@environments = []
|
@@ -8,6 +8,30 @@ require 'async/container/controller'
|
|
8
8
|
module Async
|
9
9
|
module Service
|
10
10
|
class Controller < Async::Container::Controller
|
11
|
+
def self.warmup
|
12
|
+
begin
|
13
|
+
require 'bundler'
|
14
|
+
Bundler.require(:preload)
|
15
|
+
rescue Bundler::GemfileNotFound, LoadError
|
16
|
+
# Ignore.
|
17
|
+
end
|
18
|
+
|
19
|
+
if Process.respond_to?(:warmup)
|
20
|
+
Process.warmup
|
21
|
+
elsif GC.respond_to?(:compact)
|
22
|
+
3.times{GC.start}
|
23
|
+
GC.compact
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.run(configuration)
|
28
|
+
controller = Async::Service::Controller.new(configuration.services.to_a)
|
29
|
+
|
30
|
+
self.warmup
|
31
|
+
|
32
|
+
controller.run
|
33
|
+
end
|
34
|
+
|
11
35
|
def initialize(services, **options)
|
12
36
|
super(**options)
|
13
37
|
|
@@ -23,7 +47,7 @@ module Async
|
|
23
47
|
super
|
24
48
|
end
|
25
49
|
|
26
|
-
# Setup all
|
50
|
+
# Setup all services into the given container.
|
27
51
|
#
|
28
52
|
# @parameter container [Async::Container::Generic]
|
29
53
|
def setup(container)
|
@@ -14,16 +14,17 @@ module Async
|
|
14
14
|
# @parameter environment [Build::Environment] The environment to use to construct the service.
|
15
15
|
def self.wrap(environment)
|
16
16
|
evaluator = environment.evaluator
|
17
|
-
service_class = evaluator.service_class || self
|
18
17
|
|
19
|
-
|
18
|
+
if service_class = evaluator.service_class || self
|
19
|
+
return service_class.new(environment, evaluator)
|
20
|
+
end
|
20
21
|
end
|
21
22
|
|
22
23
|
# Initialize the service from the given environment.
|
23
24
|
# @parameter environment [Build::Environment]
|
24
|
-
def initialize(environment)
|
25
|
+
def initialize(environment, evaluator = environment.evaluator)
|
25
26
|
@environment = environment
|
26
|
-
@evaluator =
|
27
|
+
@evaluator = evaluator
|
27
28
|
end
|
28
29
|
|
29
30
|
def to_h
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2024-03-
|
40
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: async
|
metadata.gz.sig
CHANGED
Binary file
|