async-service 0.3.1 → 0.5.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: 9cc88c459de375f6f169538ac495f1688e090e9d7dc09476d406129a314df3e0
|
4
|
+
data.tar.gz: 888a501d887e5344b21a4df3ae7f084ba885972482e2f38ca0d41cf6c4649c4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc182db3fce5dd07be4011ff9c066db3a4d754f9dd330b920805a6b0c103c38c11b9a905c2af2b9701306abef16f693e16e7336fa2eb2d85bbee3c59d05bc4c
|
7
|
+
data.tar.gz: f63f65f0497ec2eb74f21e421064715a82d8d794936533d9d123acade3bdd5dcbeb04860a3d42c89a379a504e85979120cf83fbbdf07e8765a0d844f1ee15402
|
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, **options)
|
28
|
+
controller = Async::Service::Controller.new(configuration.services.to_a, **options)
|
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.5.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
|